Auto-update the Successor Task Status.

Auto-update the Successor Task Status.

Hello folks!

We have come up with a new use case for custom function to help you automate the workflow of your tasks. Users can write their own Custom Functions using deluge and call them from a workflow.

Consider a scenario where the status of the successor task gets updated automatically once the predecessor task is marked complete. This can be done by creating a custom function in Deluge. You can add arguments using the "Task Status" field and associate it to a layout based on your preference. These arguments can be called in the function to automate your task flow. Click here to learn how to create a custom function.

Create a new connection

  1. Navigate to the Setup icon and select Marketplace.
  2. Click Connections under Marketplace and then Create Connection.
  3. Click Default Services under Pick your service.
  4. Select Zoho Projects.
  5. Enter Update Task Status as the Connection name and select the scopes ZohoProjects.tasks.READ, ZohoProjects.projects.READ, ZohoProjects.tasks.UPDATE

  6. Click the Create and Connect button.
  7. You will be prompted to connect to the newly established connection
  8. Click the Proceed button.
  9. The connection will be created once the accept button is clicked.

Note : Remember that 'Use Credentials of Login User' has to be switched off.

Workflow rule for automatically updating a Task

  1. Click in the top navigation bar.
  2. Navigate to Task Automation and click Workflow Rules .
  3. Click New Workflow Rule.
  4. Enter the workflow name, description, and select the required layout.
  5. Under Execute on, choose 'Update' then Choose 'Field Specific and Select 'Status' from drop down menu.
  6. Click Next.

Create and associate the custom function to the workflow

  1. Now, create a custom function and associate it with the workflow rule.
  2. Click on Add Action and then select Associate Custom Function.
  3. Click Create Custom Function in the Associate Custom Function page.
  4. In the Create Custom Function page type in the function name as Update Task Status.
  5. Add Arguments for project id, portal id, and milestone id as shown in the image below.
  6. Use this as the Sample Code and click Save.
  7. Associate the created Custom Function.
  8. Click Save Rule.

Sample Code:
  1. // Please replace 'xxxxxxxxx' with the project connection name with scopes ( ZohoProjects.tasks.READ, ZohoProjects.projects.READ, ZohoProjects.tasks.UPDATE )
  2. //Replace Custom Status to be update in successor task
  3. statusName = "In Review";
  4. // ZohoProjects API Endpoint
  5. projectsAPIEndPoint = " https://projectsapi.zoho.com/restapi";
  6. // Invoke Get Task details API
  7. taskDetails = zoho.projects.getRecordById(portalId,projectId,"tasks",taskId,"xxxxxxxxx");
  8. info taskDetails;
  9. info "-------------------------------------";
  10. // Get successor Task Ids From Task Details API Response
  11. if(taskDetails != null && taskDetails.get("tasks") != null)
  12. {
  13. taskInfo = taskDetails.get("tasks").get(0);
  14. currentTaskStatus = "";
  15. if(taskInfo != null && taskInfo.get("status") != null && taskInfo.get("status").get("name") != null)
  16. {
  17. currentTaskStatus = taskInfo.get("status").get("name");
  18. }
  19. info "Current Status " + currentTaskStatus;
  20. info "-------------------------------------";
  21. //Check task status is completed.
  22. if(currentTaskStatus == "completed" && taskInfo != null && taskInfo.contains("dependency") && taskInfo.get("dependency").contains("successor"))
  23. {
  24. taskSuccessor = taskInfo.get("dependency").get("successor");
  25. dependencyInfo = taskInfo.get("dependency").get("dependencyDetails");
  26. info taskSuccessor;
  27. info "-------------------------------------";
  28. if(taskSuccessor.size() > 0)
  29. {
  30. // Get Task Layout Details For Getting Status Ids
  31. taskLayoutDetails = invokeurl
  32. [
  33. url :projectsAPIEndPoint + "/portal/" + portalId + "/projects/" + projectId + "/tasklayouts"
  34. type :GET
  35. connection:"xxxxxxxxx"
  36. ];
  37. info taskLayoutDetails;
  38. info "-------------------------------------";
  39. statusNamevsIdMap = Map();
  40. // Get Task Status Id from task layout Response
  41. if(taskLayoutDetails != null && taskLayoutDetails.get("status_details") != null)
  42. {
  43. statusDetails = taskLayoutDetails.get("status_details");
  44. for each status in statusDetails
  45. {
  46. statusNamevsIdMap.put(status.get("name"),status.get("id"));
  47. }
  48. }
  49. }
  50. info "Status NamevsId Map: " + statusNamevsIdMap;
  51. // update status id to all successor tasks
  52. for each successorTaskId in taskSuccessor
  53. {
  54. if(statusNamevsIdMap.containKey(statusName) && dependencyInfo.containKey(successorTaskId))
  55. {
  56. successorTaskDetails = dependencyInfo.get(successorTaskId);
  57. successorProjectId = successorTaskDetails.get("PROJECTID");
  58. updateTaskParameter = Map();
  59. updateTaskParameter.put("custom_status",statusNamevsIdMap.get(statusName));
  60. info "updateTaskParameter: " + updateTaskParameter;
  61. //Invoke Update Task API
  62. taskDetails = zoho.projects.update(portalId,successorProjectId,"Tasks",successorTaskId,updateTaskParameter,"xxxxxxxxx");
  63. info "taskDetails: " + taskDetails;
  64. }
  65. }
  66. }
  67. }
  68. return "success";
  69. // Please replace 'xxxxxxxxx' with the project connection name with scopes ( ZohoProjects.tasks.READ, ZohoProjects.projects.READ, ZohoProjects.tasks.UPDATE )
If you would like us to help you will a new use case, leave it as a comment below or mail us at: support@zohoprojects.com .




    • Sticky Posts

    • Set Task Dependencies for Improved Project Management

      Task dependencies refers to the relationship between tasks, where the start or finish of one task relies on the start or finish of another. These dependencies are crucial for the successful completion of a project, as they help to ensure that all tasks
    • Project Billing with the Staff Hours Method in Zoho Projects

      The Staff Hours Billing Method in Zoho Projects allows you to bill your clients based on the actual time spent by each team member on a project, at the rate set for each user. This is useful for projects where different skill sets are needed and service
    • Manage Documents with SharePoint Extension in Zoho Projects

      SharePoint is a digital platform to store and manage your documents. Multiple users can work on the same document simultaneously, which enhances your team's productivity. By installing the extension in Zoho Projects, users can access the documents seamlessly
    • Share Captured Content as Work Items with Zoho Annotator for Zoho Projects

      Zoho Annotator is a free browser extension to annotate web pages and images. The extension allows users to: capture, annotate, and share visual content within Zoho Projects. create tasks, issues, or statuses with annotated images or videos as attachments
    • Auto-update the Successor Task Status.

      Hello folks! We have come up with a new use case for custom function to help you automate the workflow of your tasks. Users can write their own Custom Functions using deluge and call them from a workflow. Consider a scenario where the status of the successor