Getting the ID of a Workflow Task

Getting the ID of a Workflow Task

Hi guys

I have a Blueprint which - as a Deal proceeds through it - automatic tasks are created via Workflow Tasks.

This is great, but it relies on CRM users having to manually close tasks as they proceed through the Blueprint.

Ive written a function  which closes redundant tasks. Its basically:

  1. relatedTask = zoho.crm.getRelatedRecords("Tasks","Deals",dealID.toLong());

  2. for each  task in relatedTask
  3. if(task.get("Status") != "Completed")
  4. {

  5. if(stage == "Stage 1")
  6. {
  7. if(task.get("Subject").contains("Stage 1 Task"))
  8. {
  9. mapVariable = Map();
  10. mapVariable.put("Status","Completed");
  11. updateTask = zoho.crm.updateRecord("Tasks",task.get("id"),mapVariable);
  12. }
  13. }
  14. else if(stage == "Stage 2")
  15. {
  16. if(task.get("Subject").contains("Stage 2 Task"))
  17. {
  18. mapVariable = Map();
  19. mapVariable.put("Status","Completed");
  20. updateTask = zoho.crm.updateRecord("Tasks",task.get("id"),mapVariable);
  21. }
  22. }
  23. }
  24. }

This is great but it relies on the tasks containing a string to identify the task to close. If someone renames the task, then it wont get closed automatically.

What I need to do is be able to target the ID of the workflow task. I can see it in the url via the CRM interface:

https://crm.zoho.eu/crm/####/settings/workflow-tasks/485458000000710170

So how can I get at the ID?

Thanks