Code Execute
Run inline JavaScript in a secure Jint sandbox with full access to workflow variables and a 5-second execution limit.
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
- Full ECMAScript 5.1 support plus partial ES6 (arrow functions, template literals,
let/const, destructuring) - All workflow variables are available as JavaScript globals (e.g.,
invoiceTotalis available directly) - Built-in JavaScript objects:
Math,Date,JSON,Array,String,Number,RegExp,Object - 5-second execution timeout in high-isolation mode — prevents runaway scripts
- Powered by Jint v4.1.0 — no Node.js, no browser APIs
- The
resultvariable can be any type: string, number, boolean, object, array - Runtime errors produce detailed error messages on the error port
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
| Scenario | Why Code Execute? |
|---|---|
| Complex conditional business logic | Multi-step if/else trees that are unwieldy in Switch nodes. E.g., tier calculation based on spend, recency, and product category. |
| Custom string formatting | Pad order numbers, build template strings with multiple variable substitutions, format currency in a specific locale. |
| Date arithmetic | Calculate days between dates, add business days, determine the start of the current quarter. |
| Data normalization | Normalize an irregular data structure that Data Mapping's one-transform-per-field model cannot handle in a single pass. |
| Regex operations | Complex pattern matching and extraction using the full JavaScript RegExp API. |
| Custom aggregations | Multi-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.