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-statewrites 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
someVariableused inside an expression block.
Outputs
- state (object): The updated state object after the key has been set.
Notes
- Use
set-statewhen 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.keyNameinside an expression block. - To update a variable (not state), use
set-variableinstead. - State is scoped to a single flow run and does not persist across runs.
Difference from set-variable
set-variable | set-state | |
|---|---|---|
| What it manages | Named scalar variables | A structured key-value state object |
| Access syntax | variableName inside an expression | state.keyName inside an expression |
| Best for | Simple intermediate values | Complex, structured shared data |

