Portal Community
What is Code Execute?

Code Execute runs a block of JavaScript code in a sandboxed Jint v4.1.0 engine. All workflow variables are injected as JavaScript globals, so your script can read and compute on any value in memory. The script must set a result variable — whatever value is assigned to result when the script completes becomes the node's output data, accessible downstream via output.NodeName.result.

Key Capabilities

Sandbox Restrictions

The following globals are disabled or sandboxed for security: eval, Function (constructor), require, fetch, XMLHttpRequest, setTimeout, setInterval. Network access, filesystem access, and process spawning are not available. Scripts that attempt to use these will either receive a no-op or throw a SecurityException that fires the error port.

Common Use Cases

ScenarioWhy Code Execute?
Complex conditional business logicMulti-step if/else trees that are unwieldy in Switch nodes. E.g., tier calculation based on spend, recency, and product category.
Custom string formattingPad order numbers, build template strings with multiple variable substitutions, format currency in a specific locale.
Date arithmeticCalculate days between dates, add business days, determine the start of the current quarter.
Data normalizationNormalize an irregular data structure that Data Mapping's one-transform-per-field model cannot handle in a single pass.
Regex operationsComplex pattern matching and extraction using the full JavaScript RegExp API.
Custom aggregationsMulti-field aggregation logic beyond what CollectionOperation's single-expression reduce supports.

In This Guide

Configuration

The script property, variable injection mechanism, sandbox constraints, and timeout behaviour.

Input & Output

Output ports, the result variable contract, and how to access script output from downstream nodes.

Examples

Five real JavaScript examples: business tier calculation, date arithmetic, string formatting, regex extraction, and array aggregation.