Code step: run JavaScript in a workflow
Write JavaScript that takes named inputs from your data and returns an object for later steps. Runs in a sandbox: 5 seconds, no network, no packages.
Updated
Code runs a bit of JavaScript with inputs from your data and gives back what it returns.
How to set it up
- Add a Code step.
- Click Add input for each value the code needs: a name, and the data to put in it.
- Write the code. Each input is available as
inputs.name.returnan object; it becomes data for later steps. - Test this step runs it and shows what it returned.
const total = Number(inputs.price) * 1.19;
return { total: total.toFixed(2) };Limits
- 5 seconds and 32 MB of memory per run of the step.
- No network and no packages: no
fetch, noawait, no npm. Use an HTTP request step to call an API, then pass its response in as an input. - Code up to 20,000 characters.