Portal Community

Properties

PropertyTypeRequiredDefaultDescription
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.

Variable Access in Scripts

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

FeatureSupport
ECMAScript 5.1Full support
Arrow functions (() => {})Supported (ES6)
Template literals (`${var}`)Supported (ES6)
let / constSupported (ES6)
Destructuring assignmentSupported (ES6)
Promises / async-awaitNot supported
ES Modules (import/export)Not supported
Node.js built-ins (require, process, etc.)Not supported (sandboxed)

Available Globals

GlobalAvailableNotes
MathYesFull Math object: Math.round, Math.max, Math.floor, etc.
DateYesStandard Date constructor and methods
JSONYesJSON.parse and JSON.stringify
Array, String, Number, Object, RegExpYesStandard prototype methods available
evalSandboxedPresent but disabled — throws SecurityException
Function (constructor)Sandboxednew Function() is disabled
fetch, XMLHttpRequestNot availableNetwork calls from scripts are not permitted
setTimeout, setIntervalNot availableAsync scheduling is not supported in scripts
consolePartialconsole.log output is captured in execution logs but not in output
5-Second Timeout

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 };"
  }
}