Callback Custom Functions  


    Callback custom functions allow you to manipulate data within ServiceDesk Plus MSP whenever an event occurs in an external application. For instance, you can notify ServiceDesk Plus MSP whenever a ticket is raised in an external application like Jira. Callback functions are created using Deluge script which allows you to perform different types of operations including external API calls. The functions are executed by calling their respective URL.
     
     

    Creating a Callback Custom Function

      
    To create a callback custom function,

    1. Go to Admin > Developer Space (General Settings in Old UI) > Custom Functions.

    2. Under Callback Custom Functions tab, click New or Add New and provide the following:

    • Function Name: Provide a unique name for the function.
    • Return Type: Choose a return type. The supported types are map, string, int, bool, date, float, and void.
    • Description: Provide a relevant description about the function.
    • API Name: Provide a unique name. This value will be used to generate the URL.
    • URL to execute this Custom Function: This value is auto-generated.
    • Publish: Select this option to allow external applications to use this API URL. Selecting this option makes API Name mandatory.
    • Parameters: Define parameters by providing a name and a return type to use them in the function. To add a new parameter click Add, to remove an existing parameter click Remove beside the parameter. You can add up to 10 parameters.
    • Define the function: Use the Deluge editor to define your callback function. You can use the drag-and-drop interface to add your preferred elements to your function. To learn more about deluge scripting, click here.

     

    3. Finally, click Save.

     
    Invoking Callback Custom Function   


    External applications can invoke callback custom functions using the URL. The format of the URL generated will be
     http://<servername>:<port>/AppIntegrations?serviceName=callbackFunctions&api_name=<API_Name>&auth_token=<token_value_string>&PORTALID=<portal-id>&arguments{"<parameter_name1>":"<value>","<parameter_name2>":"<value>"}

    • Servername is the name of the server where ServiceDesk Plus MSP is installed. You can also use the IP address.
    • Port is the server's port configured for ServiceDesk Plus MSP.
    • API Name is the user provided name when defining the callback function.
    • Token_value_string is a randomly generated encrypted value. Each function will have a unique auth token. Auth token of callback function will be generated every time when publish operation is triggered.
    • Portal ID is a numerical identifier for instance.
    • Arguments are the parameters defined for the callback function. Arguments should be passed as json. For example, arguments = {"name":"tom","id":123}

     
    Note: You can use Global Functions with callback functions. To include a global function within the callback function, specify the function name using its internal name in the "global_function_<id>" format. To manage global functions, go to the Global Functions tab. To learn more about global functions, click here.


     
    Callback Custom Function Responses   


    The following are the responses from ServiceDesk Plus MSP to external applications for different scenarios when the callback functions are invoked.
     

    Scenario Response Description
    Success {
       "status":200,
       "content":{
          "result":"success",
          "output":"<output from the function>"
       }
    }
    This response is generated when the execution is successful.
    Error {
       "status":200,
       "content":{
          "result":"failed",
          "errorMessage":"<error cause>"
       }
    }
    This response is generated when an error occurs during execution.
    Invalid URL {
       "status":200,
       "content":"Invalid callback function url"
    }
    This response is generated when the URL is valid. This is applicable when the URL is incorrect or if an unpublished URL is accessed.

     

    View, Edit, or Delete Callback Custom Functions   

       
    You can manage callback custom functions from the list view. To access it, go to Admin > General Settings > Callback Custom Functions. All functions are listed here along with their status. On this page, you can limit the number of entries per page by choosing your preferred limit from the drop-down. You can also search for functions by name or navigate between pages.
     

     
    Note: The status Published will be shown, when the Publish option is enabled for the function. Otherwise, the status Draft will be shown.
     
    * To edit a function, click the name of the function or select Edit from the Actions  menu against the function, make the necessary changes, and click Save.
    * To delete functions, select the functions and click Delete. To delete a single function, select Delete from the Actions menu against the function.
     

    Zoho Corp. All rights reserved.