component-state (set & reset)
Use actions to set or reset component state. Component state belongs to a specific component instance, such as a form, field, list, or picker. It lets you control UI behavior, preserve values, and reset component data when a screen or workflow starts over.
The set-state action updates a specific component state key by referencing its state path.
The reset-component-state action resets component state. You can reset all component instances, or only selected instanceIds.
Refer to state for more information on the available state options and how they work.
Configuration options
A set-state or reset-component-state action can be configured in various ways, either by using an event or an action button to trigger the change:
onFocus— executes the action when the screen gains focus.onRefresh— executes the action when the screen is refreshed.As the main action on the jig, and when you press the action, the
set-stateorreset-component-stateaction will be executed.
Some properties are common to all actions, see Common action properties for the list of actions and their configuration options.
state
Reference the component state key you want to update, for example =@ctx.components.notes.state.value.
value
Provide the new value for the component state using an expression, text, input, or datasource value.
title
Provide the action button with a title, for example, Apply default value.
instanceIds
Optional list of component instanceId values to reset. Omit this property to reset all components in the selected scope.
title
Provide the action button with a title, for example, Reset screen state.
icon
Select an icon to display when the action is configured as the secondary button or in a header action.
isHidden
false hides the action button, true shows the action button. The default setting is true.
style
isDanger - Styles the action button in red or your brand's designated danger color.
isDisabled - Displays the action button as greyed out.
isPrimary - Styles the action button in blue or your brand's designated primary color. isSecondary - Sets the action as a secondary button, accessible via the ellipsis. The icon property can be used when the action button is displayed as a secondary button.
reset-component-state supports two reset patterns:
Omit
instanceIdsto reset all component instances in the selected scope.Provide
instanceIdsto reset only selected components in that scope.
How to configure component state
Add an instanceId to the component whose state you want to reference or reset.
Use action.set-state to update a specific component state key, such as value, data, or another supported state property.
Use action.reset-component-state to reset all components in a scope, or only selected instanceIds.
Examples and code snippets
This example demonstrates how to reset component state.
Reset saved product selectors
This action uses action.reset-component-state with two instanceIds.
Reset screen components
This action uses action.reset-component-state. Because instanceIds is omitted, all components on the screen are reset.
This approach gives you granular reset behavior. You can reset one component, a selected group of components, or every component in the jig.

Considerations
action.set-stateupdates a specific component state path. Use the exact component state reference, for example=@ctx.components.notes.state.value.instanceIdsis optional. Omit it to reset all component instances in the selected scope.For resetting solution state keys, use solution-state (set & reset).
See also
Last updated
Was this helpful?