×
×
×
×

Function Stage

Use the Function stage to run custom logic that no other stage covers — creating a ticket in your ITSM tool, sending device data to another system, or applying a calculation to values collected earlier in the workflow. When the workflow reaches this stage, it runs the selected function, passes it any values you configured, and then continues to the next stage.

Workflow canvas highlighting the Function stage.

What This Stage Solves

The built-in stages cover the common cases — read a value, branch on it, run a script, notify someone. But some things sit outside that set: raising a ticket in a system DEX doesn't manage, or applying logic specific to how your organisation works. The Function stage is where you write that yourself.

The problemWhat Function does about it
Every detected issue still needs a ticket raised by handCreates the ticket automatically, with the device details already filled in
Device data stays inside DEX and never reaches your other toolsSends the collected values to an external system
A decision needs logic the built-in stages can't expressRuns your own code as part of the workflow
A process in another platform has to be kicked off manuallyTriggers it from within the workflow

Example

Managed Device Restart

In this workflow, the Function stage is what creates the audit trail. Each time a device is found to have gone more than 5 days without restarting, the Function writes an entry into the organisation's asset tracking system — naming the device and how long it had gone without restarting — so IT can later see every restart the workflow enforced and why.

Managed device restart workflow showing the Function stage.

The function is written in Zoho Deluge, because that log entry needs real values from the workflow — the device name and the number of days. A JavaScript function would suit a task that needs nothing passed in.

Supported Languages

LanguageBest for
JavaScriptSelf-contained logic that runs on its own, with no values passed in from the workflow
Zoho DelugeFunctions that need workflow data — Deluge lets you define typed parameters, so values like a disk percentage or device name can be passed in
Function creation panel showing the supported language options.
Note

Zoho Deluge is Zoho's own scripting language. Choose it when the function needs information from earlier stages; choose JavaScript when it doesn't.

How to Configure

  1. Drag the Function stage onto the canvas and connect it to the preceding stage.
  2. Enter a Name for the stage (required).
  3. Enter a Stage Description (optional).
  4. Select a function from Available Functions.
    • If the function you need does not exist, click + to create one — see Creating a New Function below.
    • If you selected a Zoho Deluge function with parameters, a Parameters section appears — assign a value to each one. JavaScript functions have no parameters to configure here.
Function stage configuration with parameters.
  1. Connect the Function stage to the next stage in your workflow.

Creating a New Function

  1. Click + next to Available Functions.
  2. Enter a Function Name (required).
  3. Optionally, click Add Description.
  4. Choose the Language — the next steps differ depending on which you pick.

If you chose JavaScript:

  • A code editor opens with a starting function execute(){} template
  • Write your logic inside the function
  • Click Save, or Save As Draft to finish it later
JavaScript function editor.

If you chose Zoho Deluge:

  • Define the function's Input Parameters — these decide what data the function can receive later:
Zoho Deluge function input parameter configuration.
  • Argument Name — what the parameter is called, for example mailAddress
    • Type — String, Integer, Float, or Boolean
    • Argument Default Value (optional) — used when no value is supplied
    • Click + to add another parameter, or to remove one
  • Click Create Function

Once created, the function appears in Available Functions and can be selected in any Function stage.

This step only defines what parameters the function expects — their names and types. After you click Create Function, you return to the stage panel, where a Parameters section appears listing each parameter by name.

Function stage parameter value selection.

What You Can Pass to a Parameter

Applies to Zoho Deluge functions only. Once the function is selected, each parameter you defined appears with a dropdown. Pick a value from the list — there's no variable syntax to type.

SourceWhat it includes
Previous stage outputA value produced by an earlier stage in the workflow
Device propertiesDetails about the device, such as network information or OS version
Sensor fieldsFields from your existing sensors; selecting one runs that sensor during the workflow to fetch its value.

Connecting to Other Services

Available for Zoho Deluge functions only.

A Connection handles the authentication between your function and an outside service. Rather than putting credentials into your script, you set the sign-in up once as a Connection, and the function uses it every time it runs. Connections cover the common authentication methods — API Key, Basic, OAuth 1, OAuth 2, and AWS Signature Version 4 — so most Zoho and third-party services can be reached.

Function editor Connection configuration.

Click Connection at the top right of the code editor to create one or pick an existing one. Each Connection is given a link name, and that name is how you refer to it in your script — for example, in an invoke url task.

For the full setup steps and the list of supported services, see Zoho's Connections guide.

Things to Know

  • Connections to outside services are available in Zoho Deluge only
  • Only Zoho Deluge functions accept parameters, and their values are chosen from a dropdown — JavaScript functions have nothing to configure in the stage
  • Produces no output — later stages cannot use the function's result
  • Once created, a function can be reused in any other Function stage.