Run Code Integration

Overview

The Run Code integration 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.

Run 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

Run Code

Executes user-defined JavaScript code and returns the processed result to the workflow context.


When to Use Run Code

Use Run 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 Run Code to a Workflow

  1. Open the Decimal workflow editor

  2. Add a Trigger or connect from an existing node

  3. From Transform, select Run Code

  4. 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 Run 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:

  1. Trigger

  2. Call API

  3. Run Code (process response)

  4. If Else or Set Variable

This pattern allows raw API data to be reshaped before further use.

Last updated