Power Code
AI-generatedSummary
Executes the supplied JavaScript code using the selected mode and available built-in libraries, then returns the code’s result as workflow items.
Inputs
- Mode — Choose whether to run the code once for all input items (default) or once for each item. In all-items mode, access the input JSON objects through
itemsor$input; in each-item mode, useitem,$item,$index, or$input. - JavaScript Code (required) — JavaScript to execute. The node exposes the listed libraries and a
$()helper for accessing upstream node data. Return an object or an array of objects to produce output.
Output shape
A list of workflow items, each with a json object.
In all-items mode, an array result becomes multiple output items; a non-undefined value becomes one item, while
undefinedproduces no items. In each-item mode, each input produces one output item; returningundefinedpasses through that input’s JSON. With Continue On Fail enabled, execution errors become{error: message}items; otherwise an error stops execution.