Power of Automation :: Auto update a custom field based on Parallel transition under Blueprint

Power of Automation :: Auto update a custom field based on Parallel transition under Blueprint

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. 

Let’s check out this use case from a customer -

Our customer has configured four parallel transitions in a blueprint and wants the custom field "Pending committee" (a multi-user pick list field) in tasks to be automatically updated according to these parallel transitions.

Based on their business use case, each transition corresponds to an approval process conducted by a distinct committee within their organization. If the approval for a given transition has not been completed, depending on the current approval status and the identity of the user performing that transition, the appropriate committee member should be automatically assigned to the custom field "Pending committee" to reflect the outstanding approval requirement.

This can be accomplished using the below code. Create a connection using the scopes ZohoProjects.Projects.ALL, ZohoProjects.tasks.ALL, ZohoProjects.users.ALL” and update the connection name ‘******’ in the below code. Find the attached screenshot of the Arguments.

Here is the link to know how to create a connection.

transitionAndProcess = Map();
transitionAndProcess.put("Infrastructure",{"cf":"infrastrucure_approval_status","approver":"infrastructure_team_member"});
transitionAndProcess.put("Infosec",{"cf":"infosec_approval_status","approver":"infosec_team_member"});
transitionAndProcess.put("Privacy",{"cf":"privacy","approver":"privacy_team_member"});
transitionAndProcess.put("Operations Risk",{"cf":"operational_risk_approval_status","approver":"operational_risk_team_member"});
transitionAndProcess.put("Legal",{"cf":"legal_approval_status","approver":"legal_team_member"});
transitionAndProcess.put("Technology",{"cf":"legal_approval_status","approver":"technology_team_member"});
transitionAndProcess.put("Fraud Committee",{"cf":"fraud_committee_approval_status","approver":"fraud_committee_team_member"});
transitionAndProcess.put("Data Architect",{"cf":"data_architect_approval_status","approver":"data_architect_team_member"});
// transitionAndProcess.put("Data CoE", {"cf":"data_co_e_approval_status","approver":data_co_e_approver});
// transitionAndProcess.put("Compliance", {"cf":"compliance_approval_status","approver":compliance_approver});
transitionName = affectedFields.get("edits").get(0).get("transition_name");
// transitionName = "Infrastructure";
if(transitionAndProcess.containKey(transitionName))
{
getTaskDetails = invokeurl
[
url :endPointV3 + portalId + "/projects/" + projectId + "/tasks/" + taskId
type :GET
connection:"*****"
];
info getTaskDetails;
cf = transitionAndProcess.get(transitionName).get("cf");
status = getTaskDetails.get(cf);
info status;
if(status.equalsIgnoreCase("Need more Document"))
{
approver = transitionAndProcess.get(transitionName).get("approver");
approverTeamMember = getTaskDetails.get(approver).get("zpuid");
info approverTeamMember;
params = Map();
valueMap = List();
valueMap.add({"zpuid":approverTeamMember});
// if(getTaskDetails.containsKey("review_pending_committee_list"))
// {
// for each  committee in getTaskDetails.get("review_pending_committee_list")
// {
// valueMap.add({"zpuid":committee.get("zpuid")});
// }
// }
params.put("review_pending_committee_list",{{"add":valueMap}});
info params;
updateTask = invokeurl
[
url :endPointV3 + portalId + "/projects/" + projectId + "/tasks/" + taskId
type :PATCH
parameters:params.toString()
connection:"******"
];
info updateTask;
}
}
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. 


    • Sticky Posts

    • Schedule Exports for Regular Project Updates

      Tracking project data often means exporting data at regular intervals. Instead of manually exporting data every time, users can schedule exports for Phases, Tasks, and Tasks in Zoho Projects. These exports can be set to run once, daily, weekly, or monthly
    • Set Custom Business Calendars and Holidays for Global Teams

      Managing a project across diverse teams means accounting for more than just tasks and deadlines; it means acknowledging how and when each team actually works. Users might follow different working days or observe region-specific holidays that cannot be
    • Introducing Version-3 APIs - Explore New APIs & Enhancements

      Happy to announce the release of Version 3 (V3) APIs with an easy to use interface, new APIs, and more examples to help you understand and access the APIs better. V3 APIs can be accessed through our new link, where you can explore our complete documentation,
    • Restore Trashed Records Anytime Within 30 Days

      Access the recycle bin from the Data Administration tab under the settings page in Zoho Projects, which gives better control over the trashed data. When records like projects, phases, task lists, tasks, issues, or project templates are trashed, they are
    • Organize and Clone Task Custom Views

      We have rolled out two new enhancements to task custom views: Custom View Groups and Custom View Clone. Custom View Groups Similar to predefined view groups, we have introduced groups for custom views to help organize and categorize them. My Custom Views: