Hello Everyone,
A Custom function is a user-written set of code to achieve a specific requirement. Set the required conditions needed as when to trigger using the Workflow rules (be it Tasks / Project) and associate the custom function to it.
The requirement was to check for duplicate Tasks within a project and automatically notify both the Project Owner and the Task Owner via email with subject line “Duplicate task found".
As per design, there is no such restriction to validate the Task name upon creation in Zoho Projects. However, we can alert the owners upon creation via email. This was successfully implemented using the Task custom function along with Workflow rules.
Implementation:
Upon Task creation, the custom function code below would be triggered using Workflow rules to check if there are any duplicate Tasks found with the same name. If yes, then an email alert is automatically triggered to the Project owner and Task owner. Sample screenshot of the email notification is attached for reference.
Custom function code:
taskName = "Test task";
searchParam = Map();
searchParam.put("search_term",taskName);
searchParam.put("module","tasks");
// Within project search
projectsearch = invokeurl
[
url :projectsAPIEndPoint + "/portal/" + portalId + "/projects/" + projectId + "/search"
type :GET
parameters:searchParam
connection:"XXXXX"
];
info projectsearch;
projectOwnerEmail = projOwnerDetails.get(0).get("email");
if(projectsearch.containsKey("tasks")) {
tasks = projectsearch.get("tasks");
content = "Duplicate task found : "+taskName+"<br><br>";
for each task in tasks
{
if(taskName.equalsIgnoreCase(task.get("name"))){
content = content+"<a href="+taskURL+">"+task.get("key")+"</a><br>";
}
}
// info content;
sendmail
[
from: zoho.loginuserid
to: projectOwnerEmail+","+actionPerformer
subject: "Duplicate task found"
message: content
]
}
return "success";
Make sure to replace XXXXX with Zoho Projects connection link name along with scope ZohoProjects.search.READ. Please find the screenshot of the list of parameters to be mapped for reference.
Above custom function enabled the customer to automatically identify the duplicate Tasks and immediately notify the respective owners, eliminating manual intervention and significantly improving task accuracy.
We hope you found this post useful. If you have any questions, feel free to share them in the comments below.