Hi all,
I have a workflow triggered when a potential is win. It copies (with a custom function) the Potential_closing_date into a custom field in account named ''last_closing_date''. This works fine, here is the custom function :
acctIdStr=input.acctId.toString();
mp=map();
mp.put("Last closing date",input.closing_date);
update = zoho.crm.updateRecord(("Accounts"),acctIdStr,mp);
info mp;
info update;
I also built a custom function to recopie the ''last_closing_date'' field into all my contacts. Here is the code :
acctIdStr=input.acctId.toString();
relatedcontacts = zoho.crm.getRelatedRecords("Contacts",("Accounts"),acctIdStr);
info relatedcontacts;
for each ele in relatedcontacts
{
contId=ifnull(ele.get("CONTACTID"),"");
mp=map();
mp.put("Last closing date",input.closing_date);
update = zoho.crm.updateRecord("Contacts",contId,mp);
info mp;
info update;
}
The function works well, my problem is I cannot find the right workflow to trigger it automatically.
I tried with ''when the account is create/edit'', thinking it would work.
It doesn't work, I think, because it's a worklfow that edit the ''last_closing_date'' and not a human, so the worklfow to copie the information form Accounts to Contacts, doesn't happen...
How can I get around that ?
I don't want to have to manually update the account with a dumb filed just to make sure the information is updated... And I don't want to do it based on the ''last_closing_date'' date/time, because I need my contact to be updated every time without thinking about it.
Thank you all for your help!