JavaScript Module
Run sandboxed JavaScript inside workflows to compute values, reshape payloads, and call allow-listed APIs.
Workflow Engine V 2.0.0Description
What this does
The JavaScript Module exposes a single sandboxed Jint engine task. Scripts run in-process on the engine, see the full workflow context, and return when execution finishes — so you can compute derived variables, branch on logic the standard tasks don't cover, and reshape payloads inline.
Every script runs under strict mode with CLR import disabled, reflection blocked, eval/Function(string) disabled, and per-execution budgets for wall-clock time, statement count, recursion depth, and memory. Outbound HTTP via httpFetch is opt-in per environment, host-allow-listed, and SSRF-guarded against private/loopback addresses.
What you can build
- Compute derived variables with
JSTask— totals, hashes, formatted strings — before downstream tasks read them. - Reshape
ContextPayload— flatten nested API responses, rename keys, drop fields. - Fine-grained branching — set
session.TaskOutputor arouteKeyfor a downstream gateway to switch on. - Inline validation — fail the task or set
context.errorto route a bad reply to an error flow. - Allow-listed outbound HTTP — call a partner API via
httpFetch, parse the JSON, lift a few fields intocontext.
See the setup guide for configuration and full task reference.