Function thinklet
The Function thinklet enables custom data transformations and computations using JavaScript. While built-in thinklets handle most tasks, the Function thinklet provides flexibility for complex data manipulation and workflow logic.
How it works
Add JavaScript code to the Function thinklet to transform data, generate insights, and automate workflow decisions.
Use cases
Use the Function thinklet for:
Data transformation – Convert values, format data, and compute new metrics.
Time calculations – Determine time differences and track durations.
Decision automation – Use computed outputs to drive conditional workflow logic.
Restrictions
To ensure performance, security, and predictability, the Function thinklet enforces the following rules:
The Function thinklet runs in a secure and isolated environment. It cannot make HTTP requests, access external services or APIs, or interact with any system outside the workflow. This restriction guarantees that execution remains safe, consistent, and compliant with security policies.
Function thinklets must complete all logic within 5 seconds. Scripts that exceed this time limit will be automatically terminated. As a result, introducing artificial delays or using the Function thinklet to pause workflow execution is not supported.
Use the Function thinklet exclusively for fast, local data processing and decision-making. For any advanced use cases involving delays or external interactions, consider using purpose-built thinklets.

Configuring the Function thinklet
Simplify third-party integrations by converting raw data into meaningful formats to, for example, calculate the number of days between two dates, without using workarounds or external tools.

Name: Enter a unique name for the Function thinklet.
ID: The system generates the ID automatically based on the name.
Description (optional): Describe the purpose of the thinklet and what it does. This information is useful for others using the workflow who may not be familiar with it.
Parameters: Select Add parameter to configure up to 5 thinklet parameters that also become input parameters for the function logic.
ID: Define the input parameter ID. Validation logic allows only the characters that are supported by JavaScript.
Value: Set the corresponding parameter value—database value, output of another thinklet, global parameter, or custom value.
You can select manual custom fields—
user
ordevice
attributes—as parameter values in thinklets to use environment-specific data as input.
Outputs: Select Add outputs to configure up to 5 outputs for the function.
Name: Enter a unique name for the desired output.
ID: The system generates the ID automatically based on the name.
JavaScript: Write a JavaScript code that defines the function's logic based on the input parameters. The script should also define any outputs that contain the IDs of defined Outputs.
You can Generate with AI the JavaScript for the Function thinklet.
Generating JavaScript with AI for Function thinklets
To generate with AI the JavaScript that defines the wokflow Function thinklet:
Click the Generate with AI button.
Insert your Prompt request describing input parameters, desired outputs, and required transformations. Refer to prompt examples for more details.
Examine the Explanation and ensure the generated Code follows the appropriate script structure and avoids unsupported syntax.

JavaScript Examples for Function thinklets: prompts and codes
Find below examples of JavaScript AI prompting and coding:
Last updated
Was this helpful?