Can't create task programmatically using deluge

Can't create task programmatically using deluge

I have a Date/Time field like this



when it is edited, I want to create a task using deluge function. I use the code below to create a task. but unfortunately, the task is never created even I run it using 'execute' button on function editor. what went wrong?




  1. void automation.Create_Task_For_Leads_Follow_Up_In_Deal_Module(Int DEAL_ID)
  2. {
  3. dealDetails = zoho.crm.getRecordById("Deals",DEAL_ID);
  4. nextFollowUpTime = dealDetails.get("Next_Follow_Up_Time").toString("yyyy-MM-dd'T'HH:mm:ss","IST").toTime("yyyy-MM-dd'T'HH:mm:ss").addMinutes(60).toString("yyyy-MM-dd'T'HH:mm:ss+07:00");
  5. phone = dealDetails.get("Phone");
  6. popUpReminderTime = nextFollowUpTime.subMinutes(15);
  7.     dueDate = nextFollowUpTime.addHour(2);   
  8. subject = "this is subject";
  9. description = "this is description";
  10. info popUpReminderTime;
  11. info dueDate;
  12. info nextFollowUpTime;
  13. mp = Map();
  14. mp.put("Subject",subject);
  15. mp.put("Description",description);
  16. mp.put("$se_module","Deals");
  17. mp.put("What_Id",DEAL_ID);
  18. mp.put("Owner",dealDetails.get("Owner").get("id"));
  19. mp.put("Due_Date",dueDate);
  20. mp.put("Remind_At",{"ALARM":"FREQ=NONE;ACTION=POPUP;TRIGGER=DATE-TIME:" + popUpReminderTime.toString("yyyy-MM-dd'T'HH:mm:ss'+07:00'")});
  21. mp.put("Status","Not Started");
  22. zoho.crm.createRecord("Tasks",mp);
  23. }