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
-
Navigate to the Setup icon and select Marketplace.
-
Click Connections under Marketplace and then Create Connection.
-
Click Default Services under Pick your service.
-
Select Zoho Projects.
Enter Update Task Status as the Connection name and select the scopes ZohoProjects.tasks.READ, ZohoProjects.projects.READ, ZohoProjects.tasks.UPDATE
-
Click the Create and Connect button.
-
You will be prompted to connect to the newly established connection
-
Click the Proceed button.
-
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
-
Click in the top navigation bar.
-
Navigate to Task Automation and click
Workflow Rules
.
-
Click New Workflow Rule.
-
Enter the workflow name, description, and select the required layout.
-
Under Execute on, choose 'Update' then Choose 'Field Specific and Select 'Status' from drop down menu.
-
Click Next.
Create and associate the custom function to the workflow
-
Now, create a custom function and associate it with the workflow rule.
-
Click on Add Action and then select Associate Custom Function.
-
Click Create Custom Function in the Associate Custom Function page.
-
In the Create Custom Function page type in the function name as Update Task Status.
-
Add Arguments for project id, portal id, and milestone id as shown in the image below.
-
Use this as the Sample Code and click Save.
-
Associate the created Custom Function.
-
Click Save Rule.
Sample Code:
-
// Please replace 'xxxxxxxxx' with the project connection name with scopes ( ZohoProjects.tasks.READ, ZohoProjects.projects.READ, ZohoProjects.tasks.UPDATE )
-
//Replace Custom Status to be update in successor task
-
statusName = "In Review";
-
// ZohoProjects API Endpoint
-
projectsAPIEndPoint = "
https://projectsapi.zoho.com/restapi";
-
// Invoke Get Task details API
-
taskDetails = zoho.projects.getRecordById(portalId,projectId,"tasks",taskId,"xxxxxxxxx");
-
info taskDetails;
-
info "-------------------------------------";
-
// Get successor Task Ids From Task Details API Response
-
if(taskDetails != null && taskDetails.get("tasks") != null)
-
{
-
taskInfo = taskDetails.get("tasks").get(0);
-
currentTaskStatus = "";
-
if(taskInfo != null && taskInfo.get("status") != null && taskInfo.get("status").get("name") != null)
-
{
-
currentTaskStatus = taskInfo.get("status").get("name");
-
}
-
info "Current Status " + currentTaskStatus;
-
info "-------------------------------------";
-
//Check task status is completed.
-
if(currentTaskStatus == "completed" && taskInfo != null && taskInfo.contains("dependency") && taskInfo.get("dependency").contains("successor"))
-
{
-
taskSuccessor = taskInfo.get("dependency").get("successor");
-
dependencyInfo = taskInfo.get("dependency").get("dependencyDetails");
-
info taskSuccessor;
-
info "-------------------------------------";
-
if(taskSuccessor.size() > 0)
-
{
-
// Get Task Layout Details For Getting Status Ids
-
taskLayoutDetails = invokeurl
-
[
-
url :projectsAPIEndPoint + "/portal/" + portalId + "/projects/" + projectId + "/tasklayouts"
-
type :GET
-
connection:"xxxxxxxxx"
-
];
-
info taskLayoutDetails;
-
info "-------------------------------------";
-
statusNamevsIdMap = Map();
-
// Get Task Status Id from task layout Response
-
if(taskLayoutDetails != null && taskLayoutDetails.get("status_details") != null)
-
{
-
statusDetails = taskLayoutDetails.get("status_details");
-
for each status in statusDetails
-
{
-
statusNamevsIdMap.put(status.get("name"),status.get("id"));
-
}
-
}
-
}
-
info "Status NamevsId Map: " + statusNamevsIdMap;
-
// update status id to all successor tasks
-
for each successorTaskId in taskSuccessor
-
{
-
if(statusNamevsIdMap.containKey(statusName) && dependencyInfo.containKey(successorTaskId))
-
{
-
successorTaskDetails = dependencyInfo.get(successorTaskId);
-
successorProjectId = successorTaskDetails.get("PROJECTID");
-
updateTaskParameter = Map();
-
updateTaskParameter.put("custom_status",statusNamevsIdMap.get(statusName));
-
info "updateTaskParameter: " + updateTaskParameter;
-
//Invoke Update Task API
-
taskDetails = zoho.projects.update(portalId,successorProjectId,"Tasks",successorTaskId,updateTaskParameter,"xxxxxxxxx");
-
info "taskDetails: " + taskDetails;
-
}
-
}
-
}
-
}
-
return "success";
-
// 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
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.
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
Zoho Show Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.