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 = "";
  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: .

                        Zoho Marketing Automation
                                • Sticky Posts

                                • 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
                                • 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
                                • Announcing ZUG MEA Meet-ups (Middle East and Africa)- Interact with Zoho Projects & Sprints Experts in your city!

                                  Hello Everyone! We are thrilled to announce the Zoho Community User Meet-up initiative aimed at engaging with users in and around Middle East and Africa. In this meet-up, our team will help you understand hybrid project management using the Zoho Projects
                                • Announcing ZUG APAC Meet-ups (Singapore and Malaysia) - Interact with Zoho Projects & Sprints Experts

                                  We are excited to announce the Zoho User Community initiative to engage with users in Singapore and Malaysia in person and take you through Zoho Projects & Zoho Sprints. Our team will help users understand hybrid project management using the Projects
                                • Gallery Function for Updating Project Status

                                  A custom function is a software code that can be used to automate a process.  Gallery functions are a set of pre-defined custom functions in Zoho Projects. Users can automate these functions by establishing a Connection and by associating it with a Workflow.

                                Manage your brands on social media

                                        Zoho TeamInbox Resources

                                          Zoho DataPrep Resources

                                            Zoho CRM Plus Resources

                                              Zoho Books Resources

                                                Zoho Subscriptions Resources

                                                  Zoho Desk Resources

                                                    Zoho Projects Resources

                                                      Zoho Sprints Resources

                                                        Qntrl Resources

                                                          Zoho Creator Resources

                                                            Zoho WorkDrive Resources

                                                              Zoho Campaigns Resources

                                                                Zoho CRM Resources

                                                                • CRM Community Learning Series

                                                                  CRM Community Learning Series

                                                                • Tips


                                                                • Functions


                                                                • Meetups


                                                                • Kbase


                                                                • Resources


                                                                • Digest


                                                                • CRM Marketplace

                                                                  CRM Marketplace

                                                                • MVP Corner

                                                                  MVP Corner

                                                                • Word of the Day

                                                                  Word of the Day

                                                                      Design. Discuss. Deliver.

                                                                      Create visually engaging stories with Zoho Show.

                                                                      Get Started Now