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 automated the creation of Projects in Zoho Projects from the Deals module in Zoho CRM.
Upon completion of that specific Project in Zoho Projects, they also wanted the Deal status to be updated as "Closed Won". This was accomplished using Custom functions along with Project workflow rules.
Custom function code:
module = "Deals";
stageName = "Closed Won";
projectDetail = invokeurl
[
url :projectsAPIEndPoint + "/api/v3/portal/" + portalId + "/projects/" + projectId + "/crm/" + module.toLowerCase()
type :GET
connection:"XXXXX"
];
info projectDetail;
deals = projectDetail.get("deals");
if(deals.size() > 0)
{
for each deal in deals
{
dealId = deal.get("id");
valueMap = Map();
valueMap.put("Stage",stageName);
valueMap.put("Closing_Date",zoho.currentdate.toString("yyyy-MM-dd"));
response = zoho.crm.updateRecord(module,dealId,valueMap);
info response;
}
}
return "success";
Make sure to replace XXXXX with the Zoho Projects connection link name along with scopes: ZohoProjects.clients.ALL. Please find the screenshot of the parameters to be mapped.
We hope you found this post useful. If you have any questions, feel free to share them in the comments below.