Code

Built-in step · 1 step

Run a small Python or JavaScript script in a secure sandbox.

To learn when to use these steps, with examples, read Call an API or run code.

Run code

Run a short Python or JavaScript script for the things no other step covers, such as reshaping data or a custom calculation. It runs offline, with no internet or file access, and returns whatever your script assigns to a variable named output.

Inputs

Languagelanguagetext
Python or JavaScript. Both run offline in the same sandbox, read the same inputs, and return what the code assigns to output. JavaScript is the language only: there is no Node, require or npm, and an error inside async code (an async function or .then) isn't reported.One of: python, javascript. Default: python.
CodecodetextRequired
Your script. Read the values you mapped in by name, or from inputs, and assign this step's result to a variable named output.
Inputsinputsobject
The workflow values your code can use. Each one gets a name you refer to in the code.
Output typeoutput_typetext
What this step returns. Auto keeps whatever your code produced; picking a type checks it before later steps use it.One of: auto, text, number, boolean (True/False), list, object. Default: auto.

Outputs

Whatever the script assigns to output, converted to the chosen output type.

Example output
{
  "currency": "USD",
  "line_count": 3,
  "total": 1249.5
}

On this page