Input & Output
Output ports, the result contract, and accessing script output downstream.
Output Ports
| Port | Condition | Description |
|---|---|---|
| success | Script completed within timeout without throwing | output.NodeName.result contains whatever value was assigned to the result variable in the script. |
| error | Script threw a JavaScript exception, timed out, or triggered a sandbox violation | Error details in output.NodeName.error. The error includes the script error message and, where possible, the line number. |
Output Data
| Field | Type | Description |
|---|---|---|
result | any | The value of the result variable at the end of script execution. Can be a string, number, boolean, object, or array. If the script completes without setting result, this field is undefined (not an error). |
Always Set
result
If your script does not assign a value to result, the success port still fires but output.NodeName.result will be undefined. Downstream nodes that attempt to use this value may behave unexpectedly. Always ensure every code path assigns result before the script ends.
Example Script Output
// Script: result = { tier: "gold", discountPct: 10 };
// Node output:
{
"result": {
"tier": "gold",
"discountPct": 10
}
}
// Downstream access:
// {@ output.CalculateTier.result.tier } → "gold"
// {@ output.CalculateTier.result.discountPct } → 10
Error Output Schema
{
"error": {
"code": "SCRIPT_EXECUTION_ERROR",
"message": "ReferenceError: 'undeclaredVar' is not defined (line 3)",
"node": "CalculateCustomerTier",
"scriptLine": 3,
"timestamp": "2026-05-23T10:34:12Z"
}
}
// Timeout error:
{
"error": {
"code": "SCRIPT_TIMEOUT",
"message": "Script exceeded maximum execution time of 5000ms",
"node": "MyCodeNode",
"timestamp": "2026-05-23T10:34:17Z"
}
}
Downstream Access Patterns
| Expression | Returns |
|---|---|
{@ output.MyScript.result } | The entire result value (object, array, or scalar) |
{@ output.MyScript.result.tier } | A property of the result object |
{@ output.MyScript.result[0] } | First element if result is an array |