How to add lookup fields and Multiselect field with PHP API

How to add lookup fields and Multiselect field with PHP API

Hi
I'm developing a integration to send leads to Zoho CRM through the API.

I'm having problems with the lookup and multiselect fields.

I'm using this code to set the multiselect value:

$specialFormat = json_encode(array($movingPriority));
$record->setFieldValue("Prioridad_de_Mudanza",$specialFormat);

But I'm getting the following error:

Details:{"expected_data_type":"jsonarray","api_name":"Prioridad_de_Mudanza"}

And regarding the lookup fields, we are using the following code:

$inmuebleInfo = array();
$inmuebleInfo['api_name']="Leads";
$inmuebleInfo['display_label']="Inmuebles";
$inmuebleInfo['id']=$propertyId;
$lookupField = ModuleAPIHandler::getLookupFieldInstance($inmuebleInfo);
$record->setFieldValue("Inmuebles", $lookupField);

The Inmuebles field is not populated with the information I set to the field.

And I have also tried with this code:
$lookupField = ZCRMLookupField::getInstance("Inmuebles");
$lookupField->setDisplayLabel="Inmuebles";
$lookupField->setId=$propertyId;
$record->setFieldValue("Inmuebles", $lookupField);

I'm getting this error:
Send More Info Lead
HTTP Status Code:202
Status:error
Message:required field not found
Code:MANDATORY_NOT_FOUND
Details:{"api_name":"id","parent_api_name":"Inmuebles"}

Could you please give me a hand to know what I'm missing?

I browse the documentation but I didn't find any information regarding both items mentioned in this topic.

Please contact me if you need further information to help me.

Regards,

    Access your files securely from anywhere









                          Zoho Developer Community




                                                • Desk Community Learning Series


                                                • Digest


                                                • Functions


                                                • Meetups


                                                • Kbase


                                                • Resources


                                                • Glossary


                                                • Desk Marketplace


                                                • MVP Corner


                                                • Word of the Day


                                                • Ask the Experts





                                                          Manage your brands on social media



                                                                Zoho TeamInbox Resources



                                                                    Zoho CRM Plus Resources

                                                                      Zoho Books Resources


                                                                        Zoho Subscriptions Resources

                                                                          Zoho Projects Resources


                                                                            Zoho Sprints Resources


                                                                              Qntrl Resources


                                                                                Zoho Creator Resources



                                                                                    Zoho CRM Resources

                                                                                    • CRM Community Learning Series

                                                                                      CRM Community Learning Series


                                                                                    • Kaizen

                                                                                      Kaizen

                                                                                    • Functions

                                                                                      Functions

                                                                                    • Meetups

                                                                                      Meetups

                                                                                    • Kbase

                                                                                      Kbase

                                                                                    • Resources

                                                                                      Resources

                                                                                    • Digest

                                                                                      Digest

                                                                                    • CRM Marketplace

                                                                                      CRM Marketplace

                                                                                    • MVP Corner

                                                                                      MVP Corner







                                                                                        Design. Discuss. Deliver.

                                                                                        Create visually engaging stories with Zoho Show.

                                                                                        Get Started Now


                                                                                          Zoho Show Resources

                                                                                            Zoho Writer

                                                                                            Get Started. Write Away!

                                                                                            Writer is a powerful online word processor, designed for collaborative work.

                                                                                              Zoho CRM コンテンツ






                                                                                                Nederlandse Hulpbronnen


                                                                                                    ご検討中の方