Custom Code
Overview
The Custom Code node allows you to execute custom JavaScript logic inside a Decimal workflow. It is designed for scenarios where no-code nodes are not sufficient and custom data processing, transformation, or calculation is required.
Custom Code acts as a lightweight compute layer within workflows and is commonly used to:
Transform API responses
Perform calculations
Format or normalise data
Apply custom business logic
Prepare data for downstream nodes
This node bridges no-code automation with low-code flexibility.
Available Module
Custom Code
The Custom Code node allows you to run user-defined custom Javascript codes and return processed results back to the workflow. Here you can define your own custom logic, processes, rules and strategies. It gives advanced control to users to manage their workflow states and build guardrails.
When to Use Custom Code
Use Custom Code when:
You need custom logic not supported by native nodes
Data needs transformation or aggregation
Calculations must be applied dynamically
Workflow behavior depends on computed values
Typical use cases include:
Parsing API responses
Calculating thresholds or metrics
Restructuring objects or arrays
Validating or enriching data
Adding Custom Code to a Workflow
Open the Decimal workflow editor
Add a Trigger or connect from an existing node
From Transform, select Custom Code
Connect the node to the previous step
Once added, the Run Code Settings panel opens automatically.
Module Configuration
Mode
The Mode determines how the code is executed.
Run Once for All Items
Executes the code once for the entire workflow execution
Suitable for aggregation, calculations, or global transformations
(Additional modes may be introduced in future versions.)
JavaScript Code
This field contains the JavaScript code to execute.
Click Open Editor to edit the full code in a popup
The code runs in the context of the current workflow item
Data from previous nodes is accessible within the execution context
Example:
return {
value: 100,
status: "processed"
};
The returned object becomes available to downstream nodes.
Output & Variables
The output of the Custom Code node is automatically passed forward in the workflow.
Downstream nodes can access:
Computed values
Transformed objects
Derived fields
Example usage:
runCodeResult.value
The exact variable structure depends on the returned object.
Example Workflow
Use Case: Transform API response data.
Workflow:
Trigger
Call API
Run Code (process response)
If Else or Set Variable
This pattern allows raw API data to be reshaped before further use.
Last updated