Skip to main content

Set Vars

Type: set • Category: flow

Description

Set workflow variables

Parameters

NameTypeDescriptionRequiredDefault
valuesobjectno

Help

Set Variables Worker

Sets workflow variables that can be accessed by subsequent workers in the workflow.

How it works:

  1. Variable Assignment: Takes a JSON object of key-value pairs
  2. Context Storage: Stores values in workflow context under 'vars'
  3. Type Preservation: Maintains original data types (strings, numbers, objects, arrays)

Parameters:

  • values: JSON object with variable names as keys and values to assign

Examples:

  • Set simple values: {"counter": 0, "status": "starting"}
  • Set complex objects: {"user": {"name": "John", "id": 123}}
  • Set arrays: {"items": [1, 2, 3, 4, 5]}

Variable Access:

  • Access in expressions: vars.counter, vars.status
  • Access in other workers: Use vars.my_variable
  • Persists throughout workflow execution

Common Use Cases:

  • Initialize counters and flags
  • Store API responses for later use
  • Prepare data for subsequent processing
  • Set default values and configuration

Notes:

  • Variables are accessible by all subsequent workers
  • Values can be overridden by later Set Vars workers
  • Complex objects and arrays are fully supported