How to Automatically add a related deal to logged calls

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
  1. //line is to get deal information using the deal number. 
  2. dealmap = zoho.crm.getRecordById("Deals", dealID);
  3. //line is because i couldnt get the search key to work in the above line
  4. dealName = dealmap.get("Deal_Name");
  5. //stuff below defines map. "what_Id" is the related field field name in calls
  6. mp = Map();
  7. mp.put("What_Id",dealName);
  8. //updates the calls to include the deal name in the related field 
  9. update = zoho.crm.updateRecord("Calls", callID, mp);

  10. info mp;
  11. 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