Connect Custom Module with Contacts via MultiSelect and Deluge

Connect Custom Module with Contacts via MultiSelect and Deluge

I have created a custom module called "Customer Account Plan" which is created by a button on the Accounts module; this button will auto complete several fields as it's creating the record.

I want to associate the Contacts that are relevant to this Account to the newly created "Customer Account Plan" record... but I'm getting a bit stuck. I have created a multifield lookup, and I want it to be populated when the button is pressed.

How can I pass all of the Contacts that match the Account into the new record.

  1. // Find Linked Contacts
  2. varContactDetails = zoho.crm.getRelatedRecords("Contacts","Accounts",custid);
  3. //Create a list of just the matching Deals IDs
  4. varContactIDs = List();
  5. for each  varContact in varContactDetails
  6. {
  7.     varContactIDs.add(varContact.get("id"));
  8.     mp.put("Contacts_Field",ifnull(varContactIDs,""));
  9. }

I get the error :
{"code":"INVALID_DATA","details":{"expected_data_type":"jsonobject","api_name":"Contacts_Field","json_path":"$.data[0].Contacts_Field[0]"},"message":"invalid data","status":"error"}

There could be more than one contact to add.
I'm fairly new at CRM Deluge so any advise is welcome

    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns 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