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

      • 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
      • Enhanced Collaboration and Global Web Tabs

        Hello Users, We are rolling out two key enhancements in Zoho Projects that will be part of our November release. Here’s what to expect: 1. Collaboration Section in the Left Navigation Panel What’s new? All communication and interactive tools will be grouped
      • Tip 37: Time Log Restriction in Zoho Projects

        Timesheet in Zoho Projects helps you big time in entering log hours for the tasks and issues and approving them. Now, with the new Time Log Restriction option, you can set daily and weekly log hour limits. You can restrict users from entering extra log hours than the permissible limit. The limits are restricted to 24 hours per day and 168 hours per week by default based on business hours. To customize, navigate to Task & Timesheet settings under Portal Configuration in Zoho Projects setup and enable
      • Rename Task Module To Suit Your Project

        Task Module in Zoho Projects gives a comprehensive view of all the action items, known as Tasks, across all projects. However, different industries may use alternative terminology for similar processes, which might not always be recognised when labelled
      • 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