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

    • 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
    • Collaborate Visually with Whiteboard in Zoho Projects

      Whiteboard in Zoho Projects allows you to collaborate visually by creating diagrams, annotating designs, and sketching project workflows using shapes, text, and images within project modules. Team members can work simultaneously, improving productivity
    • Introducing Projects 8.0 - Focusing on Ease-of-Use and New Features

      Hello everyone! It's time for the reveal of the 8th version of Zoho Projects! This year our focus has been on minimizing the learning curve and improving the ease-of-use of the tool, so anyone new to Projects can hit the ground running and existing users
    • 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
    • Work agile in Zoho Projects! The much-awaited Zoho Sprints integration is in the making.

      Let your teams work in both classic and agile methodology using our integration with Zoho Sprints. We made sure you get the best of both worlds with this integration. You can scale through teams irrespective of what methodology they use and make sure they work with speed and flexibility. And, you can do it all from one place- Zoho Projects.  Why this integration is a benefit?  This integration mostly helps in managing classic and agile practices together. Most organizations use a mix of both classic