A custom function is a software code that can be used to automate a process and this allows you to automate a notification, call a webhook, or perform logic immediately after a workflow rule is triggered. This feature helps to automate complex tasks and calculations.
Let us consider the below use case from a customer -
We have received a requirement from a customer - whenever the status of a task is updated as ‘Completed’, it should be automatically moved to another project.
To be precise, there are 2 projects 'Production Schedule' and 'Production Schedule Archive'
Initially tasks will be created in 'Production Schedule' project. And, when the status of a task is updated to "completed" then it should automatically moved to another project ‘Production Schedule Archive’.
We had accomplished this requirement using custom functions. Create a connection for the Zoho Projects service with the scope “zohoprojects.tasks.update" to replace ‘connectionprojects’ with the connection name. Click this link to learn how to create the connection. Please find the attached screenshot of Arguments.
Script to be used
// Replace yyyyy with move tasklist Id
moveProjectTasklistId = "yyyyy";
endPoint = "https://projects.zoho.com/restapi/portal/";
moveTaskParameter = Map();
// Move Task
moveTaskParameter.put("from_todolist",tasklistId);
moveTaskParameter.put("to_todolist",moveProjectTasklistId);
moveTaskResponse = invokeurl
[
url :endPoint + portalId + "/projects/" + projectId + "/tasks/" + taskId + "/move"
type :POST
parameters:moveTaskParameter
connection:"connectionprojects"
];
return "success";
To automate this, we can configure a workflow rule with the required trigger & criteria.
Writer is a powerful online word processor, designed for collaborative work.