/
change-state trigger action



change-state trigger action

Overview

You can use the Change State action in a trigger to change the workflow state automatically on a workflow event.

cdmc_visualeditor_workflowtrigger_changestateaction_named_state_condition.png

For example, it can be used to fast-track a single reviewer’s rejection decision when multiple reviewers are assigned to an approval.

cdmc_visualeditor_workflowtrigger_reviewerrejected_event_changestate_action_named_state_condition.png

Change State action parameters

Action Parameter

Value

Notes

Action Parameter

Value

Notes

State MANDATORY

Use the dropdown to select one of the states in the workflow.

The state options are populated by the states in the workflow.

Changing the state name in the workflow might cause a validation error

You can add one Change State action to a workflow trigger. When the workflow Event occurs, the trigger checks that any required Conditions are met, and if they are met, the Change State action forces a change of the state to a specified state.

This lets you respond flexibly to workflow events, such as when a single reviewer approves a page.

“change-state” JSON code

A Change State workflow trigger action added using the visual editor is automatically displayed as the “change-state” trigger action in the workflow code editor.

cdmc_codeeditor_workflowtrigger_changestate_action_onrejectedevent.png

You can also use the code editor to add the workflow trigger and the “change-state” action.

"change-state"

The trigger action "change-state" causes the state to change to the specified state if the provided parameters are valid.

  • action (change-state)

    • state❗️ destination workflow state for the action

      • state must be a state in the workflow

      • state names are case-sensitive


❗️ Mandatory parameter

state parameter

  • state parameter must be included with a valid value for the destination state


Example trigger code

"triggers": [ {"event": "on-change-state", "conditions": [ {"final":true} ], "actions": [ {"action": "change-state", "state": "Archive"} ]} ]

The example trigger listens for the workflow's change of state to the final state and immediately moves the workflow to the Archive state.

 The destination state must be included in the "change-state" action.

Here is the JSON code for the example trigger that fast-tracks a single rejected decision. You can use this to prompt remedial actions quickly, for example, when multiple reviewers are assigned to an approval.

"triggers": [ {"event": "on-reject", "conditions": [ {"state":"Review"} ], "actions": [ {"action": "change-state", "state": "Draft"} ]} ]

The trigger action moves the workflow from the Review state, which contains an approval, to the Draft state when a reviewer rejects the page.


Related pages