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.
Requirement:-
One of our customers would like to associate a specific tag to the Tasks upon creation or whenever a field update occurs in tasks where the user is designated as the Project Owner. The same can be implemented using Task custom functions along with Workflow rules in Zoho Projects.
Trigger the below custom function code along with the workflow rule condition as Task creation or updation (any field) along with Project owner name condition.
Custom function code:-
// TODO: Please create a connection for the Zoho Projects service with the scopes scopes: ZohoProjects.tags.ALL, ZohoProjects.tasks.ALL
Click this link below to learn how to create the connection.
tagsParam = Map();
tagsParam.put("tag_id","XXXXX");
tagsParam.put("entity_id",taskId);
tagsParam.put("entityType","5");
url1 = endPoint + portalId + "/projects/" + projectId + "/tags/associate";
associateTagsResponse = invokeurl
[
url :url1
type :POST
parameters:tagsParam
connection:"YYYYYY"
];
return "success";
Make sure to replace XXXXX with Tag id and YYYYYY with the Zoho Projects connections link name. Screenshot of the list of parameters to be mapped and sample Task workflow rule is attached for reference.
We hope you found this post useful. If you have any questions or wondering if your requirement could be met using custom functions, feel free to share them in the comments section below.