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:

Generate Custom Function Code using ChatGPT

You can generate code for custom functions with simple prompts using ChatGPT. For example, you can give the below shown prompt to terminate duplicate request creation by a user.

 

Generate Custom Function Code using Azure OpenAI

You can generate code for custom functions with simple prompts using Azure OpenAI. For example, you can give the prompt given below to terminate duplicate request creation by a user.



 

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.