Variable

The Variable node sets or updates a variable accessible from any node via $vars.variableName (workflow-local) or $global.variableName (persistent).

The Variable node sets or updates a variable accessible from any node via $vars.variableName (workflow-local) or $global.variableName (persistent). Use it for counters, accumulated lists, and shared state across the workflow.

Overview

PropertyValue
Inputs1
Outputs1
Output$nodeLabel.value, or access via $vars.variableName / $global.variableName

Parameters

ParameterTypeDescription
labelstringNode identifier (camelCase)
variableNamestringVariable name (used as $vars.variableName or $global.variableName). Avoid reserved names.
variableValueexpressionValue to set. Supports expressions.
variableType"auto" | "string" | "number" | "boolean" | "array" | "object"Type coercion (default: auto)
isGlobalbooleanWhen true, store in Global Variable Store (persistent, user-scoped). When false or omitted, workflow-local (in-memory).

Array Variables

Initialize arrays with $array() or $array("a", "b") in a Variable node before using .add():

{"variableName": "items", "variableValue": "$array()", "variableType": "array"}

Then add items (no $ inside parentheses):

{"variableName": "items", "variableValue": "$vars.items.add(loopNode.item)", "variableType": "array"}

Critical Rule

Never use $ inside method parentheses:

  • $vars.myArray.add(previousNode.text)
  • $vars.myArray.add($previousNode.text) – breaks the expression

Example – Counter

{
  "type": "variable",
  "data": {
    "label": "incrementCounter",
    "variableName": "counter",
    "variableValue": "$vars.counter + 1",
    "variableType": "number"
  }
}