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 take the below User Requirement -
Once the project status is changed to “On Hold" all the Employee and Manager profile users should be automatically removed from that respective project.
The code below will help you to achieve the above requirement.
endPointV3 = "https://projects.zoho.com/api/v3/portal/";
endPoint = "https://projects.zoho.com/restapi/portal/";
userParameter = Map();
userParameter.put("type",1);
userParameter.put("view_type",1);
userParameter.put("per_page",200);
userParameter.put("page",1);
usersResponse = invokeurl
[
url :endPointV3 + portalId + "/projects/" + projectId + "/users"
type :GET
parameters:userParameter
connection:”**********”
];
users = usersResponse.get("users");
for each user in users
{
if(user.get("role").get("name").containsIgnoreCase("employee") || user.get("role").get("name").containsIgnoreCase("manager"))
{
dissociateUsersResponse = invokeurl
[
url :endPoint + portalId + "/projects/" + projectId + "/users/" + user.get("id") +"/"
type :DELETE
connection:”************”
];
}
}
return "success";
Creating custom functions in Zoho Projects is straightforward and well-documented. Zoho provides a range of built-in functions that you can use as a starting point, and you can also easily define your own functions using Zoho's scripting language, Deluge. Give it a try and see how it can save your time and boost your productivity!
Watch this space for more such custom function codes.