Configuration Reference
Script property, variable injection, sandbox constraints, and execution behaviour.
Properties
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
script |
string (JavaScript) | Yes | — | The JavaScript code to execute. The script must assign a value to the result variable before it terminates. The type of result can be any JavaScript value: string, number, boolean, object, or array. |
Variable Injection
Before executing your script, BizFirst injects all current workflow memory variables as JavaScript globals. The variable name is used directly as the JS identifier.
If the workflow has a variable invoiceTotal (set by a Variable Assignment node), your script can read it directly as invoiceTotal. If a variable name contains characters invalid in JS identifiers (e.g., hyphens), it will not be injected as a global — use Variable Assignment to rename it first.
JavaScript Engine: Jint v4.1.0
| Feature | Support |
|---|---|
| ECMAScript 5.1 | Full support |
Arrow functions (() => {}) | Supported (ES6) |
Template literals (`${var}`) | Supported (ES6) |
let / const | Supported (ES6) |
| Destructuring assignment | Supported (ES6) |
| Promises / async-await | Not supported |
ES Modules (import/export) | Not supported |
Node.js built-ins (require, process, etc.) | Not supported (sandboxed) |
Available Globals
| Global | Available | Notes |
|---|---|---|
Math | Yes | Full Math object: Math.round, Math.max, Math.floor, etc. |
Date | Yes | Standard Date constructor and methods |
JSON | Yes | JSON.parse and JSON.stringify |
Array, String, Number, Object, RegExp | Yes | Standard prototype methods available |
eval | Sandboxed | Present but disabled — throws SecurityException |
Function (constructor) | Sandboxed | new Function() is disabled |
fetch, XMLHttpRequest | Not available | Network calls from scripts are not permitted |
setTimeout, setInterval | Not available | Async scheduling is not supported in scripts |
console | Partial | console.log output is captured in execution logs but not in output |
Scripts that run longer than 5 seconds in high-isolation mode are terminated and the error port fires. Design scripts to be computational only — avoid loops that could spin indefinitely. If you need longer-running logic, consider breaking work across multiple CodeExecute nodes with intermediate Variable Assignment steps.
JSON Configuration Example
{
"node_type": "CodeExecute",
"name": "CalculateCustomerTier",
"config": {
"script": "var tier = 'standard'; if (annualSpend >= 50000) { tier = 'platinum'; } else if (annualSpend >= 10000) { tier = 'gold'; } else if (annualSpend >= 2000) { tier = 'silver'; } result = { tier: tier, annualSpend: annualSpend, discountPct: tier === 'platinum' ? 20 : tier === 'gold' ? 10 : tier === 'silver' ? 5 : 0 };"
}
}