Function to copy Created Time into custom date field
Hi,
I am stuck creating two functions for a single Deals workflow.
- Copy the Created_Time field into a custom date/time field (API name = Analytics_Reporting) when stage does not equal "Closed Won".
- Copy "Closed_Date" (date field) into Analytics_Reporting (date/time field) when stage equals "Closed Won"
I am using the below function for part 1. which successfully updates the field but does not save it e.g. i trigger the workflow the function it is in > Analytics_Reporting is updated to the Created Time value > I refresh the page > Analytics_Reporting is empty again.
det = zoho.crm.getRecordById("Deals",id.tolong());
mp = Map();
mp.put("Analytics_Reporting",ifnull(det.get("Created_Time"),""));
update = zoho.crm.updateRecord("Deals",id,mp);
info mp;
info update;
I also would like help with the second part. Do I need a different function to populate a date field into a date/time field?