Custom Function: Tracking the Case Closed time

Custom Function: Tracking the Case Closed time

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:

  1. Log in to Zoho CRM with administrative privileges.
  2. Click Setup > Automation > Workflow > Create Rule.
  3. In the New Rule page, choose Cases module from the drop-down list and provide other rule details.
  4. Under Execute On, choose Create or Edit and then click Next.
  5. Specify the Rule Criteria. The rule will triggered only when a record meets the criteria mentioned here.
  6. In the Actions section, click on the Add button for Call Custom Functions.
  7. In the Configure Custom Function popup, click Write your own.
  8. Specify a name for the function.
  9. Build the Deluge Script based on the code given below.

Deluge Script:


  1. void workflowspace.CaseClosedTime(string caseID)
    {

  2. 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