Configuration
Property reference for the Function node and full documentation of the context object available inside scripts.
Properties
| Property | Required | Description |
|---|---|---|
Script | Required | JavaScript code to execute. Write full function-body code — you have access to the context object. Use return to set the output value. If no return is present, the last expression's value is used. |
Timeout | Optional | Integer. Maximum execution time in milliseconds. If the script runs longer than this value, it is terminated and the error port fires with errorCode: "timeout". If omitted, the platform's default timeout applies. |
SandboxMode | Optional | Boolean. Default true. Restricts available globals to safe JavaScript built-ins only. Set false only in trusted, self-hosted deployments. See the security model on the Overview page. |
The context Object
Inside every Function script, the context object is automatically injected. It provides read access to all workflow data:
context.input
The data passed into the current node from the preceding node's success port.
// Access the full input object
const inputData = context.input;
// Access a specific field from upstream output
const productName = context.input.product_name;
const itemCount = context.input.items.length;
context.vars
All workflow-level variables set by VariableAssignment nodes earlier in the flow.
const userId = context.vars.user_id;
const orderTotal = context.vars.order_total;
const itemsList = context.vars.items_array; // can be any type
context.nodes
Output data from previously executed nodes in this workflow run, keyed by node name or node ID.
// Access output from a node named "GetCustomer"
const customerEmail = context.nodes.GetCustomer.email;
// Access output from a node named "FetchPrices"
const prices = context.nodes.FetchPrices.items;
context.workflow
Metadata about the current workflow run.
| Property | Type | Description |
|---|---|---|
context.workflow.runId | string | Unique ID for the current workflow run instance. |
context.workflow.workflowId | string | ID of the workflow definition being executed. |
context.workflow.workflowName | string | Human-readable name of the workflow. |
context.workflow.startedAt | string | ISO timestamp when the workflow run started. |
context.workflow.triggeredBy | string | What triggered the workflow: "manual", "schedule", "webhook", etc. |
context.env
Environment-level configuration values set by administrators (read-only). Only available when SandboxMode=false or when the platform explicitly exposes specific keys to sandboxed scripts.
Return Value Behaviour
The return value of the Function script becomes the output data on the success port.
| Script Pattern | Result |
|---|---|
return { key: "value" }; | Object { key: "value" } becomes the success output data field. |
return [1, 2, 3]; | Array [1, 2, 3] becomes the success output data field. |
return "hello"; | String "hello" becomes the success output data field. |
return null; | data is null. |
No return statement | The value of the last expression is used. If the last statement is a declaration with no value, data is undefined. |
throw new Error("msg"); | Routes to error port with errorCode: "script_error" and the error message. |
return statement for clarity and predictability.
undefined, and circular references will either be omitted or cause serialisation errors. Convert Dates to ISO strings (date.toISOString()) before returning.