Skip to content

Step: Set State

  • Key: set-state
  • Category: Data & Variables
  • Description: Set or update a key on the flow's shared state object. Unlike set-variable, which manages individual named variables, set-state writes to a structured state dictionary that persists across steps.

Inputs

  • key (text, required): The state key to set (e.g., status, currentUser.name).
  • value (any, required): The value to assign to the key. Can be a string, number, boolean, object, or a variable reference such as someVariable used inside an expression block.

Outputs

  • state (object): The updated state object after the key has been set.

Notes

  • Use set-state when you need to maintain a shared object that multiple downstream steps read from.
  • Keys support dot notation for nested objects (e.g., user.profile.email).
  • All state values are accessible in subsequent steps by referencing state.keyName inside an expression block.
  • To update a variable (not state), use set-variable instead.
  • State is scoped to a single flow run and does not persist across runs.

Difference from set-variable

set-variableset-state
What it managesNamed scalar variablesA structured key-value state object
Access syntaxvariableName inside an expressionstate.keyName inside an expression
Best forSimple intermediate valuesComplex, structured shared data

Built with VitePress