Custom Scheduled Function

Custom Scheduled Function

SupportCenter Plus allows administrators to execute custom schedules using a built-in script execution tool called Custom Scheduled Function. The custom scheduled function scripts can be built from scratch using Deluge, Zoho's propriety scripting language.

 

Custom Scheduled functions can be used to build your own automation operations such as sending notifications or updating request status by analysing the queries fetched from reports.

 

Role Required: SDAdmin

 

To create custom scheduled functions, go to Admin > Developer Space > Custom Function > Scheduled Function. You can create custom schedules functions as Custom Actions or Global Functions.

Custom Actions  

Custom actions are actionable custom functions that allow users to manipulate data in SupportCenter Plus and other external applications. You can write a script to fetch data from Query Reports and execute an action based on the fetched data.

Create Custom Actions  

Use the New button to create a custom action.

Provide a name and description for your custom action.

Use the simple drag-and-drop action to select objects from the Deluge Script Editor onto the canvas.

 

 

You must write the custom schedules function with reportObj as the argument.

After executing the custom schedules function, the Map data type will be returned in the following format:

  1. {
    "message":"Executed successfully",
    "status":"success/failure"
    }

 

You can perform the specified action by returning the map from the custom schedules function. The format used in custom schedules functions is the same as the python script and class. For more details, visit this page.

The new field values must be returned from the custom schedules function in a specific format as demonstrated below:

Let's consider a sample script to update request status to Closed.

 

  1. input_data = {
    "request": {
    "status": {
    "name": "Closed"
    }
    }
    }

    for each data in dataObj{
    workorderid = data.get("workorderid");
    requeserid = data.get("Requeser_Id");
    app_url = "http://servername:portnumber/api/v3/requests/" + workorderid;
    params = {"input_data": input_data};
    response = invokeurl
    [
    url: url
    type: PUT
    parameters: params
    headers: headers
    ];
    }

 

Within custom scheduled functions, you can call global functions that can store information essential to connect with external applications, common functionalities, and configurations.

Test Execution of Scripts   

After writing the custom scheduled function,

  • Click Save and Test to test run the custom action.

  • Choose a sample report from the list of reports displayed.

  • The data that will be passed to the custom schedules function will be displayed under the parameter reportObj.

  • Click Execute.

The script will be executed and the output will be printed along with info statements that are used for debugging.

 

 If you make any API calls by using invokeurl while testing the custom schedules function, the API will be invoked. Ensure that you don't invoke an API that might result in unintended consequences.   

Debugging Tip   

When you test a custom scheduled function, you can debug the code and print the output by using a statement called info. For example, to understand the structure of reportObj and context, you can simply run the following script and study the response.

info reportObj;
info context;
return true;

 

For more details on Deluge, visit Deluge help guide. 

 

After a custom action is created, you can use it to create custom schedules. The custom schedule where the custom action is active is displayed in the custom action list view.

Custom Actions List View   

After creating custom actions, you can manage them from the list view as follows:

  • Click the  icon to edit or delete a custom action. To delete custom actions in bulk, select the custom actions and go to Actions > Delete.

  • Click the  icon to disable a custom action. Disabled custom actions are indicated using the  icon that you can click to enable a custom action. To enable/disable in bulk, select the custom actions and go to Actions > Mark as Active/Mark as Inactive.

  • Use keywords to search custom actions from the search bar.

 


    • Related Articles

    • Custom Schedules

      Custom Schedules enable you to access any data from SupportCenter Plus and schedule periodic customized actions such as sending notifications or reopening requests. You can also synchronize SupportCenter Plus data with other third-party applications ...
    • Executing Custom Function in Business Rule

      By executing custom functions in business rules, you can manipulate data in SupportCenter plus and other external applications. requestObj and context are the arguments supported in custom functions. Choose the required custom function from the list ...
    • Custom Triggers - Tasks

      Use Task Trigger to automatically trigger any 'Action' on a task using a script file or a custom function. You can define rules and apply predefined actions on tasks that match those rules. Triggers come in handy when performing actions in other ...
    • Custom Modules

      SupportCenter Plus has built-in modules such as Requests, Solutions, and configuration entities such as Users, Status, Priority, Level, and Mode. Organizations might want to create additional entities to suit their business processes and workflows. ...
    • Custom Actions

      Custom actions refer to user defined actions that can be performed on different entities across modules. For a custom action to be performed on an entity, it should be used with automation rules, subject to the availability of support. Availability ...