Schedules Use Cases

Schedules Use Cases

Schedules

Pointers 

  1. Schedules allows you to schedule the execution of custom functions and define how often they must execute.
  2. Schedules are customer-specific.
  3. You can associate one or more schedules with each scheduled function. You can enable or disable schedules as required.

Use case: Find duplicate requests of the same category periodically

Scenario:
Zylker’s IT service management team aims to improve efficiency by identifying duplicate incidents within the same category. Therefore, they want to scan the system periodically for incoming and open requests to detect multiple submissions for the same issue or service type, such as repeated software/network bug reports.

Action:
This can be achieved by using Schedules.
  1. Draft a custom function to find duplicate requests of the same category.
  2. Set frequency to execute the custom function periodically.
Configuration:
Custom Function
  1. Go to Setup > Custom Actions > Custom Functions.
  2. Select Request from the module filter.
  3. Draft a Deluge script to find duplicate requests of the same category. Or, you can import the Deluge script (Find Duplicate Requests) from Import Sample Functions on the toolbar.

Notes
Sample Code
To ensure accurate execution, check the syntax of the following code from your end before using it.

if(requestObj.containsKey("category"))
{
    category_name = requestObj.get("category").get("name");
    request_creation_time = requestObj.get("created_time").get("value");
    request_creation_time = request_creation_time.toDate().toLong();
    check_upto_time = request_creation_time - 24 * 60 * 60 * 1000;
    requester_email = requestObj.get("requester").get("email_id");
    criteria = "{list_info:{search_criteria:{field:category.name,values:['" + category_name + "'],condition:like,children:[{field:created_time.value,condition:GT,logical_operator:and,value:'" + check_upto_time + "'},{field:requester.email_id,condition:like,logical_operator:and,values:['" + requester_email + "']}]}}}";
    response = zylker.sdp.invokeurl
    [
        url :"/app/itdesk/api/v3/requests"
        type :GET
        parameters:{"input_data":criteria}
    ];
    requests = response.get("requests");
    if(requests.toJSONList().size() > 2)
    {
        return true;
    }
}
return false;

Schedules
  1. Go to Setup > Automation > Schedules.
  2. Select Zylker from the customer filter.
  3. Create a schedule, create or select the custom function to be executed, and configure the frequency as follows. The available frequencies are Once, Daily, Weekly, Monthly, Yearly.