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.
- // Find Linked Contacts
- varContactDetails = zoho.crm.getRelatedRecords("Contacts","Accounts",custid);
- //Create a list of just the matching Deals IDs
- varContactIDs = List();
- for each varContact in varContactDetails
- {
- varContactIDs.add(varContact.get("id"));
- mp.put("Contacts_Field",ifnull(varContactIDs,""));
- }
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