Custom Functions

Custom functions are programs that allow you to manipulate data within ServiceDesk Plus Cloud. Custom functions enable you to perform operations that cannot be executed via standard UI configurations.

Administrators can use custom functions to perform automations and integrations that can be contextually invoked via triggers, business rules, and timers, or via life cycles with minimal programming.

Custom functions can be written in one of the following scripting languages:

Deluge is Zoho's proprietary scripting language. To learn more about Deluge and how to write custom functions in Deluge, click here.

Supported Modules

Role Required

Sub-entities where custom functions are applicable

Requests

SDAdmin, SDSiteAdmin, HelpDeskConfig

Requests, Tasks, Approval Levels, Approvals, Notes, Email responses (for users), Work logs (requests and tasks), Work log timer

Problems

SDAdmin

Problems, Tasks, Notes, Email responses (for users), Work logs (problems and tasks)

Changes

SDAdmin

Changes, Tasks, Approval Levels, Approvals, Notes, Email responses (for users), Work logs (changes and tasks), Downtimes

Projects

SDAdmin

Projects, Milestones, Tasks (projects and tasks), Work logs (tasks. projects, and milestones), Project Members, Comments (tasks, projects, and milestones)

Releases

SDAdmin

Releases, Tasks, Approval Levels, Approvals, Notes, Email responses (for users), Work logs (releases and tasks), Downtimes

Solutions

SDAdmin

Solutions, Comments

Assets

SDAdmin, AssetConfig

All Assets, Each product types

CMDB

SDAdmin, SDCMDBAdmin

All CIs, Each CI Type

Purchase

SDAdmin

Purchases, Approval Levels, Approvals, Payments, Invoices

Contracts

SDAdmin

Contracts

Custom Modules

SDAdmin

Custom modules

Create Custom Functions 

In the Custom Functions tab, choose your preferred module from the drop-down.

Click New Custom Function and fill out the necessary information as described below:

Field

Description

Custom Function Name*

Provide a unique name for the custom function.

Description

Describe the objective and usage of the custom function.

Applies to

Choose the sub-entities within the module where the custom function is applied.

Use this custom function as a

Select the automation rule where the custom function is used. Ensure custom function returns the following values based on the automation rule where it is configured:

  • Business rule action - "Map" value
  • Workflow condition or workflow action, business rules action, timer condition - "Boolean" value
  • Request/Problem life cycle action, trigger action - "Void" value
Language Select the language to compile the custom function - Deluge, Java, or NodeJS

Script Editor

  • For Deluge, use a simple drag-and-drop motion to drag the elements to the script editor. To learn more about Deluge and how to write custom functions, click here.

  • Depending on the module selected, the following arguments will be passed in the custom function:

  • Requests - 'requestObj' and 'context'
  • Problems - 'problemObj' and 'context'

  • Changes - 'changeObj' and 'context'

  • Projects - 'projectObj' and 'context'

  • Releases - 'releaseObj' and 'context'

  • Solutions - 'solutionObj' and 'context'

  • Assets - 'assetObj' and 'context'

  • CMDB - 'ciObj' and 'context'

  • Purchase - 'purchaseObj' and 'context'

  • Contracts - 'contractObj' and 'context'

  • Custom Module - '<custom_module_api_name>Obj' and 'context'

If the custom function is configured for a request or change sub-entity, the respective sub-entity object will be passed in the parameter.  

  • For Java and NodeJS, you can compile the custom function in the script editor.

 

After compiling the custom function, click Save or Save & Execute Script.

Manage Custom Functions  

After the custom functions are created, they are available on the list view page where you can perform the following actions:

Check Usage Stats

When you execute a custom function, an API call is placed to ServiceDesk Plus Cloud. This is called an InvokeURL call.

By default, you are allowed only 200,000 executions per month and 10,000 InvokeURL calls per day from Custom Functions. You can track the executions and InvokeURL calls usage by clicking the Check Usage Stats button. In the Usage Stats pop-up, a colored progress bar is used to indicate the percentage of executions and InvokeURL calls remaining.

 

If the SDAdmin who created the first custom function is deleted, subsequent API calls will use the token of the SDAdmin who deleted them.

Business Rule Conditions and Actions  

 

Business rules help you automate various request-related tasks such as assigning a technician, status, or priority to a request; or even sending email notifications. Business rules are site-based, run on all incoming requests, and can be applied to requests when they are created, edited, or deleted.

If an incoming request matches specific conditions, business rules execute actions automatically. You can define complex conditions and actions by using custom functions.

Business Rule Conditions: In some scenarios, requesters accidentally raise several incident requests for a single issue. You can define a custom function in a business rule condition to check for and stop the creation of such duplicate requests.

Business Rule Actions: Whenever a VIP user logs a request, you can notify the support team over Cliq (a business communication app) by using a business rule action.

Click here to learn more about Business Rules with samples.

Trigger and Life Cycle Actions

Triggers allow you to automate actions when an incoming request matches specific conditions.  You can define complex actions in a trigger by using custom functions and execute them on other modules or third-party applications.

For example, you can define a trigger action to record leave on your internal HR Management app (like Zoho People), whenever a technician marks leave inside ServiceDesk Plus Cloud.

Click here to learn more about Trigger Actions with samples.

Life Cycle allows administrators to formulate a resolution process with built-in guidance for the help desk technician. A life cycle ensures efficient process adherence, establishes a directional flow, minimizes the scope for human errors, and provides privileged (role-based) access to status transitions.

To automate processes through life cycle, you can define actions using custom functions that will be executed under pre-specified conditions.

Click here to learn more about Life Cycle Actions.

Scheduled Functions  

Scheduled functions allow you to automate the execution of custom functions at regular intervals. For example, you can schedule a webhook with appropriate data to send requests periodically to an external application, which will then create an entry or perform other operations in the external application.

For each scheduled function, you can define one or more schedules under Setup > Automation > Schedules. You can also create and schedule a custom function directly under Schedules.

The Scheduled Functions tab lists the custom functions available to schedule as well as the already scheduled custom functions.

Click here to learn how to schedule a custom function.

Callback Functions  

You can manipulate data within ServiceDesk Plus Cloud whenever an event occurs in an external application using callback functions. For example, you can write a callback function to notify ServiceDesk Plus Cloud whenever a ticket is added in your bug tracking software, such as Backlog and update the necessary information in ServiceDesk Plus Cloud. A callback function is the same as a webhook, only triggered from an external application to perform a task within ServiceDesk Plus Cloud.

Callback functions are internally executed through custom scripts, which allow you to perform all types of actions including API calls to external applications.

Callback functions can be written in one of the following scripting languages:

Role Required: SDAdmin and HelpDeskConfig can define callback functions. SDSiteAdmin can only view them.

Creating a Callback Function 

Go to Setup > Developer Space > Custom Function and select Callback Functions from the drop-down.

  1. Click New Custom Function. Alternatively, you can use the pre-built custom functions written in Deluge by clicking Import Sample Functions.

  2. Provide a unique name to the callback function and enter a description.

  3. Provide a unique API name. A URL that is auto-generated using the API name will be displayed in the corresponding field.

  4. Select Publish to allow users to invoke the URL from external applications.

  5. Optionally, you can type in the parameters as raw data or form data.

    1. Form Data: The Request body must be passed as a key-value pair. If you are going with this data format, you need to enter the parameter key along with its data type.

    2. Raw Data: The Request body must be passed as raw data. Data of any Content-Type, such as application/json and application/xml, will be treated as plain text and passed to the custom function as a string under the 'body' parameter.

  1. Select your preferred language from the Language drop-down - Deluge, Java, NodeJS.

  2. Click Save. To test the script, click Save & Execute Script.

At any time you want to suspend the access of the custom function by external users, you can unpublish the callback function.

Click here to learn how to define a callback function.

Custom Menu Actions

Custom menu actions execute custom functions to perform a variety of user-defined actions within ServiceDesk Plus Cloud and external applications.

Click here to learn more about Custom Menu Actions.