Hello Everyone,
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.
Lets take the below use case from a customer -
if(tasklist_picklist == null) { return "No value selected"; } else { info tasklist_picklist; tasklists = tasklist_picklist.toList(); } endpoint = "https://projectsapi.zoho.com/"; getAllTasklists = invokeurl [ url :endpoint + "api/v3/portal/" + portalId + "/projects/" + projectId + "/tasklists" type :GET connection:"projects" ]; // info "getAllTasklists : "+getAllTasklists; for each tasklist in getAllTasklists.get("tasklists") { tasklistName = tasklist.get("name"); if(tasklists.contains(tasklistName)) { tasklists.remove(tasklists.indexOf(tasklistName)); info tasklistName + " removed"; } } info " tasklists : " + tasklists; taskTemplateResponse = invokeurl [ url :endpoint + "api/v3/portal/" + portalId + "/templates/tasklists" type :GET connection:"projects" ]; if(taskTemplateResponse.containKey("task_list_templates")) { templates = taskTemplateResponse.get("task_list_templates"); templateMap = Map(); for each template in templates { info "Template Name : " + template.get("name") + "-------- > Id : "+ template.get("id"); if(tasklists.contains(template.get("name"))) { templateMap.put(template.get("name"),template.get("id")); } } } info templateMap; for each template in templateMap { // info template; taskTemplateId = template; associateTaskTemplateParameter = Map(); associateTaskTemplateParameter.put("task_template_id",taskTemplateId); associateTaskTemplateParameter.put("shift_days",toString (zoho.currenttime,"YYYY-MM-dd'T'HH:mm:ss") + "Z"); associateTaskTemplateResponse = invokeurl [ url :endpoint + "restapi/portal/" + portalId + "/projects/" + projectId + "/tasklists/" type :POST parameters:associateTaskTemplateParameter connection:"projects" ]; info associateTaskTemplateResponse; } 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.