Knowledge Base

Run JavaScript

Runs sandboxed JavaScript (Jint engine) against pipeline input and workflow variables. Use for custom logic that declarative Transform nodes cannot express — without spawning a shell process.

When to use

  • Compute derived fields from upstream JSON (thresholds, scoring, routing keys).
  • Combine input with vars (workflow + global persistent variables).
  • Lightweight data shaping on edge agents and desktop — same engine as on-prem API.

When not to use

  • Declarative extract/rename/scale — prefer Transform.
  • OS commands, Python, or Node on disk — use Command Line instead.
  • Reusable compiled logic versioned in git — use a custom plugin DLL.

Script API

NameDescription
inputValue from the upstream node (object, array, string, or number after JSON parse).
varsMap of workflow + global variable keys to string values.
log(...)Append debug lines (captured in output logs).
returnReturn an object/array/primitive — becomes output downstream.

Properties

PropertyTypeDescription
JavaScripttextareaUser script body. Supports {{$var.key}} placeholders in the editor text. Required.
Timeout (seconds)numberHard limit for script execution. Default: 10, max 60.

Example

const temp = input?.temperature ?? 0;
const limit = Number(vars.threshold ?? 30);
log(`temp=${temp} limit=${limit}`);
return {
  alert: temp > limit,
  temperature: temp,
  level: temp > 40 ? 'critical' : 'normal'
};

Outputs

FieldDescription
outputValue returned by the script (or null).
logsArray of strings from log(...).
durationMsExecution time in milliseconds.

Runtime export & agent bundles

  • Built into Nodlyn.Runtime — no extra plugin DLL required.
  • Works in single-workflow exports and multi-workflow agent bundles.
  • Not available in cloud execution (on-prem / edge only).

Notes

  • Marked Dangerous — operator approval is required at runtime (see Approval Gates).
  • Sandbox limits: statement count, call depth, 1 MB output cap. No filesystem or network APIs exposed.
  • Cannot be used inside sub-workflows that contain other Dangerous nodes (same rule as Command Line).
  • In Dry-Run mode the script is not executed — a preview message is returned.

See also

Nodlyn Assistant
Ask me anything about Nodlyn
Hi! 👋 I'm the Nodlyn assistant. Ask me about the product, workflow components, connectors, agent runtime, agent capabilities, deployment, and more. If I don't know an answer, I'll point you to our contact form.