How to Automatically add a related deal to logged calls
Update: I put updated working code at the bottom of the post
In my crm I always have a deal for every contact. I usually am referencing the deal and rarely the contact. So if there isn't a log called in the deal module i usually miss it. That wasn't too bad until I started using telephony and it only logs in in the contact module so I am missing all of the logged calls.
So i made this function to fire whenever a call was logged.
It is supposed to add the related deal to the calls module
- //line is to get deal information using the deal number.
- dealmap = zoho.crm.getRecordById("Deals", dealID);
- //line is because i couldnt get the search key to work in the above line
- dealName = dealmap.get("Deal_Name");
- //stuff below defines map. "what_Id" is the related field field name in calls
- mp = Map();
- mp.put("What_Id",dealName);
- //updates the calls to include the deal name in the related field
- update = zoho.crm.updateRecord("Calls", callID, mp);
- info mp;
- info update;
I am getting this error message back
Info
- {"What_Id":"1258 - Joseph Sergi - Other Insulation"}
- {"code":"MANDATORY_NOT_FOUND","details":{"api_name":"$se_module"},"message":"required field not found","status":"error"}
I think the MANDATORY_NOT_FOUND means its the wrong module name but that doesn't make sense.
I've been messing with this for hours and would appreciate any help.
Thanks in advance