Scenario: Tracking the Case Closed time
We create cases and close them but how do we keep track of the details on when the case was closed?
This custom function helps you track the closed time of a case, in a custom date-time field. You can then generate reports based on the closed time.
You need to have a custom date time field to update the Closed Time.
Please follow these steps:
Deluge Script:
void workflowspace.CaseClosedTime(string caseID)
{
caseiD1=input.caseID;
resp = zoho.crm.getRecordById("Cases",caseiD1.toLong());
info resp;
respStr=resp.toString();
respMap=respStr.toMap();
modifiedTime=respMap.get("Modified Time");
status=respMap.get("Status");
info status;
if((status != null) && (status == "Closed"))
{
closedTime=modifiedTime;
upresp = zoho.crm.updateRecord("cases",caseiD1,{ "Closed Time" : closedTime });
info upresp;
}
}
Note: This custom function is for the Cases module. You can modify this to track the potential closing date, task closed date and similar such date time values.
Please refer to the following link to know more about this feature:
https://www.zoho.com/crm/help/automation/custom-functions.html