Add a Set State action when the workflow should store values that later actions can reuse for the rest of the run.
State variables remain available after the Set State action executes, until the workflow run completes. Unlike action outputs, which belong to a specific step, state variables are shared across the run.
For how state differs from inputs and outputs, see Understand workflow variables. For examples of state variable paths, see Workflow variables reference. For an overview of workflow actions, see Understand workflow actions.
Before you begin
Make sure you have:
- A workflow open in the designer with a configured Start action.
- The Experience Designer or Tenant administrator role.
- The value you want to store already available, or an expression that calculates it.
- Clear, descriptive names for the state variables you want to create.
When to use a Set State action
Use Set State when the workflow should:
- Save intermediate results for later steps.
- Store identifiers such as a request ID or resume token.
- Remember a decision made on a Condition branch.
- Reuse a calculated value without recalculating it.
Add a Set State action
- Open the workflow in the workflow designer.
- From the Actions palette, add a Set State action.
- Connect it to the previous action.
- Select the Set State action to open the node editor.
- Enter a clear Name.
For example: Store request number
- Select Add Variable, then configure the assignment:
- Enter the variable name in Name.
- Select the value Type.
- Enter the value in Value, using @ or an expression that resolves to the data you want to store.
- If the selected type requires a shape, configure Item fields or Object fields as shown by the editor.
For example:
| Setting | Value |
| Name | requestNumber |
| Type | Appropriate type for the value |
| Value | Expression that returns the request number |
- Select Add Variable again if the same Set State action should set multiple state variables.
Changes save automatically.
A Set State action must contain at least one assignment. Each assignment must have a variable name and value before the workflow can validate or publish successfully.
Reference state variables later
After the Set State action runs, later actions can access the values from the variable picker under State variables.
For example:
| Variable | Example path |
| Resume token | $resumeToken |
| Request number | $requestNumber |
| Manager ID | $managerId |
Type @ in a field that accepts workflow data to select a state variable instead of typing the path manually.
For more information about workflow data and variable types, see Workflow variables reference.
Example assignments
| Variable name | Typical value source |
| requestNumber | Output from a Run Tool that created a request |
| resumeToken | Identifier that you will match in a later Wait or event callback |
| isEligible | Result of a comparison that you want later Condition actions to reuse |
Set multiple state variables
You can set multiple variables in a single Set State action when the values are established at the same point in the workflow.
For example, after a Run Tool returns the result of an employee request, you could store:
- requestNumber
- requestStatus
- isEligible
Later actions can then reference those state variables without depending directly on the original action's outputs.
Use separate Set State actions when values are established at different points in the workflow or when doing so makes the workflow easier to understand.
Next steps
- Use the new state variables in a Condition, Run Tool mapping, Agent instructions using the supported token syntax, or another Set State action.
- Use one clear name for each concept and avoid storing the same value under multiple state variable names.
- Test the workflow and confirm the state values in the run.
- Publish the workflow when you're ready.