Automation Series: Auto-create Dependent Task on Status Change

Automation Series: Auto-create Dependent Task on Status Change

In Zoho Projects, you can automatically create and assign a dependent task when a task’s status is updated. This helps teams stay aligned, ensures reviews happen on time, and reduces manual effort.

In this post, we’ll walk through an easy setup using a Custom Function scripted in Deluge.

Use-case

In a scenario where an auditor schedules a task that requires a compliance review, once the task status is updated from Scheduled, a Dependent task is automatically created and assigned to the Compliance team. All related attachments are carried forward, ensuring the auditors and reviewers have full overview and can proceed without manual coordination.

To configure this flow,

1. Navigate to the upper-right corner of the page and click  → Developer Space → Connections Create Connection using the following scopes:
  1. ZohoProjects.portals.READ
  2. ZohoProjects.portals.ALL
  3. ZohoProjects.projects.READ
  4. ZohoProjects.tasks.CREATE
  5. ZohoProjects.tasks.UPDATE
  6. ZohoProjects.tasks.READ
  7. WorkDrive.workspace.ALL
  8. WorkDrive.files.ALL
  9. ZohoProjects.documents.READ
  10. ZohoProjects.documents.CREATE


2. Navigate to  → Developer Space Custom Functions. Under the Task tab, create a new custom function and add the following Deluge script.
Notes
Ensure that the portal URL aligns with your data centre. If not, the function may not execute as expected. Also, make sure the specified team is associated with the project; otherwise, the task assignment will fail.
  1. // TODO : Replace Dependency Type here with "FS, SS, SF, FF"
  2. // scopes: ZohoProjects.portals.READ, ZohoProjects.portals.CREATE, ZohoProjects.projects.READ, ZohoProjects.tasks.CREATE, ZohoProjects.tasks.UPDATE, ZohoProjects.tasks.READ, WorkDrive.workspace.ALL, WorkDrive.files.ALL, ZohoProjects.documents.READ, ZohoProjects.documents.CREATE.
  3. // get team id
  4. endPoint = "https://projects.zoho.in/restapi/portal/";
  5. endPointV3 = "https://projects.zoho.in/api/v3/portal/";
  6. getTaskStatusTimeline = invokeurl
  7. [
  8. url :endPointV3 + portalId + "/projects/" + projectId + "/tasks/" + taskId + "/status-timeline"
  9. type :GET
  10. connection:"connectionprojects"
  11. ];
  12. size = getTaskStatusTimeline.size() - 1;
  13. oldStatusName = getTaskStatusTimeline.get(size).get("previous_status").get("name");
  14. if(oldStatusName.containsIgnoreCase("Scheduled"))
  15. {
  16. teamName = "Compliance Team";
  17. userGroupsResponse = invokeurl
  18. [
  19. url :endPoint + portalId + "/projects/" + projectId + "/usergroups/"
  20. type :GET
  21. connection:"connectionprojects"
  22. ];
  23. teams = userGroupsResponse.get("userGroups");
  24. for each team in teams
  25. {
  26. if(team.get("groupObj").get("group_name").containsIgnoreCase(teamName))
  27. {
  28. teamId = team.get("groupObj").get("group_id");
  29. }
  30. }
  31. teamIds = List();
  32. teamIds.add(teamId);
  33. dependencyType = "FS";
  34. //Create Tasks parameters
  35. values_map = Map();
  36. values_map.put("name","Compliance Audit Verification");
  37. values_map.put("description"," Review task created for the Security and Compliance team to validate requirements, assess risks, and confirm adherence to defined standards. Attachments from the originating task are included for reference.");
  38. values_map.put("associated_teams",teamIds);
  39. //Invoke Create Task
  40. createTaskResponse = zoho.projects.create(portalId,projectId,"tasks",values_map,"connectionprojects");
  41. // Get TaskId From Task response
  42. if(createTaskResponse != null && createTaskResponse.get("tasks") != null)
  43. {
  44. taskInfo = createTaskResponse.get("tasks").get(0);
  45. newTaskId = taskInfo.get("id_string");
  46. // copy attachments to new task
  47. getAttachmentsResponse = invokeurl
  48. [
  49. url :endPointV3 + portalId + "/projects/" + projectId + "/attachments?entity_type=task&entity_id=" + taskId
  50. type :GET
  51. connection:"connectionprojects"
  52. ];
  53. if(getAttachmentsResponse.get("attachment").size() > 0)
  54. {
  55. taskAttachments = getAttachmentsResponse.get("attachment");
  56. for each attachment in taskAttachments
  57. {
  58. associateParam = Map();
  59. associateParam.put("entity_type","task");
  60. associateParam.put("entity_id",newTaskId);
  61. associateToTaskComment = invokeurl
  62. [
  63. url :endPointV3 + portalId + "/projects/" + projectId + "/attachments/" + attachment.get("attachment_id")
  64. type :POST
  65. parameters:associateParam
  66. connection:"connectionprojects"
  67. ];
  68. }
  69. }
  70. //Add Dependancy Between Tasks Parameter
  71. dependencyParam = Map();
  72. dependencyParam.put("taskid",newTaskId);
  73. dependencyParam.put("predids",taskId);
  74. dependencyParam.put("projId",projectId);
  75. dependencyParam.put("toupdate","dependencyset");
  76. dependencyParam.put("childprojId",projectId);
  77. dependencyParam.put("dependencytype",dependencyType);
  78. // invoke task dependency Api
  79. dependency = invokeurl
  80. [
  81. url :endPoint + portalId + "/projects/" + projectId + "/taskdependency/"
  82. type :POST
  83. parameters:dependencyParam
  84. connection:"connectionprojects"
  85. ];
  86. info dependency;
  87. info "-------------------------------------";
  88. }
  89. }
  90. return "success";
Info
Customise the task name and description in lines 36 and 37 as needed, then save the function.

Replace "connectionprojects" with your Zoho Projects connection name in lines 10, 21, 51, and 84 of the deluge.

3. Add the below arguments during configuration.



After mapping the arguments, save the function and enter the Task ID when prompted. This custom function will execute automatically whenever an issue status changes from Scheduled, creating the dependent task as defined in the workflow rule.

4. After saving the custom function, Navigate to  → Automation → Workflow Rules → Projects TabNew Workflow Rule with the below settings.

5. Configure the workflow to trigger Based on User Action when a task is Updated, and associate the custom function to execute automatically on the status change.



With this automation in place, tasks are triggered automatically, dependencies are assigned, and supporting attachments are transferred ensuring hand-offs without manual effort.

If you have any questions, feel free to drop a comment below or reach out to us at support@zohoprojects.com.
    • Sticky Posts

    • Automation Series: Auto-create Dependent Task on Status Change

      In Zoho Projects, you can automatically create and assign a dependent task when a task’s status is updated. This helps teams stay aligned, ensures reviews happen on time, and reduces manual effort. In this post, we’ll walk through an easy setup using
    • Time Log Reminder

      Tracking the time spent on tasks and issues is one of the most important functions of a timesheet. However, users may forget to update the time logs because they have their own goals to achieve. But, time logs must be updated at regular intervals to keep
    • Introducing the Zoho Projects Learning Space

      Every product has its learning curve, and sometimes having a guided path makes the learning experience smoother. With that goal, we introduce a dedicated learning space for Zoho Projects, a platform where you can explore lessons, learn at your own pace,
    • Update on V2 API End-of-Life Timeline

      Dear Users, Earlier this year, we shared the launch of the V3 APIs and requested users to migrate from the older V2 APIs by December 2025. We have received valuable feedback from our users and partners regarding their migration timelines. We are happy
    • Automation Series: Auto-update Phase Status

      Hello Folks! You can auto-update your phase's status based on status of underlying tasks using custom functions. In this series, we will showcase how to create and run custom functions, using Deluge, with ease. Follow the steps below and automate your