Code (JS)

Free

Run a JavaScript snippet in a sandbox — compute, validate, branch.

Runs a small JavaScript snippet in a sandbox. It can read/write variables and choose the outcome. See the deep-dive: Custom logic with Code (JS).

Fields

FieldTypeRequiredNotes
LanguageselectJavaScript
CodecodeyesThe snippet

Outcomes

  • ok — the snippet returned truthy.
  • error — returned falsy or threw.

How it works

vars is readable and writable (assign to save), user is read-only, and the return value picks the branch.

vars.total = Number(vars.price) * Number(vars.qty);
return vars.total > 0;   // ok if positive, else error