I cannot get my function to work to update all contacts inside an account when the account record is updated
I need to be able to update a field on the account record and all contacts related to that account be populated with that update. Sometimes it will be adding new data to the field, other times it will be overwriting existing data.
Example: If I change Account Status to Former Customer in the Accounts Module, I need it to update Account Status in the Contacts Module for the contacts associated with that Account.
Same thing for other fields, such as Account Type.
I configured a function related to the Accounts Module and here is the script:
ContactList = zoho.crm.getRelatedRecords("Contacts","Accounts",acctId.toLong(),1);
info list(ContactList.toJSONList());
for each ele in ContactList
{
contactId = ifnull(ele.get("id"),"");
mp = Map();
mp.put("Account_Status",accountstatus);
mp.put("Account_Type",accounttype);
update = zoho.crm.updateRecord("Contacts",contactId,mp);
info mp;
info update;
}
However, it is not working. Please advise.
Thank you,
Sharon Wells