Create Custom Function: A new event, updates a date/time field in the Deals Module.

Create Custom Function: A new event, updates a date/time field in the Deals Module.

I need help using a workflow to update a custom date/time field in the Deals Module.

Basically, I want to run a report that shows me the last "Appointment Date" for a Deal. To do that, I need a new event to populate the "From" date in the Appointment Date field in the deals module. 

Currently using this and it's not working:

  1. eventDetails = zoho.crm.getRecordById("Events",eventId.toLong());
  2. seid = ifnull(eventDetails.get("RELATEDTOID"),"");
  3. semodule = ifnull(eventDetails.get("SEMODULE"),"");
  4. fromdate = ifnull(eventDetails.get("Start DateTime"),"").toDate();
  5. if(semodule == "Deals")
  6. {
  7. mp = Map();
  8. mp.put("Appointment_Date",fromdate);
  9. updateResp = zoho.crm.updateRecord("Deals",seid,mp);
  10. info mp;
  11. info updateResp;
  12. }