Power Code icon

Power Code

Execute custom JavaScript code with 59+ built-in libraries

Power Code

AI-generated

Summary

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 items or $input; in each-item mode, use item, $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 undefined produces no items. In each-item mode, each input produces one output item; returning undefined passes through that input’s JSON. With Continue On Fail enabled, execution errors become {error: message} items; otherwise an error stops execution.

Links

Discussion