This article will explain how to upgrade workflows that use the State Machine and Set Next State actions to Nintex Automation Cloud. In Nintex Automation Cloud, the state machine concept and capability of "states" is similar, but is called "stages".
- The State Machine action becomes the Branch by stage action.
- The Set Next State action becomes Change stage action.
- States are now called stages.
- For the Change stage action, you will be able to use a variable directly to set the next stage. You will not need to select "Other value...", then provide a variable or text in a separate box.
- For the Branch by stage action, you will be able to use a variable directly to set the Initial stage property. You will not need to select "Other value...", then provide a variable or text in a separate box.
- Note, in Nintex for Office 365 a state branch could restart itself by inserting the Change state action in that branch and setting the Set next state property to itself. At the time of publishing for this article, in Nintex Automation Cloud, the Change stage action will fail at runtime if a stage tries to restart itself in this manner. You will need to first, set the next stage to a different stage, then, from that next stage, change back to the previous stage to restart. See the configuration section called, Restarting a stage using Change Stage action, below.
Branch by stage action - Set the initial stage by using a variable
- Create a variable to store the initial stage you want the Branch by stage action to begin with. The [Initial Stage] variable has a default value set to "Manager Review" in this example. This can also be set by using the Set a variable value action.
- In this next image, the preconfigured workflow variable named [Initial Stage] is used to set the initial stage to follow.
Restarting a stage using Change Stage action
In the next workflow example, a reviewer has the ability to restart a Document Review stage by selecting the Restart Review outcome when completing a task assignment. Currently, the Change stage action cannot restart the Document Review stage if it lives within that stage respectively. It must change the workflow to a different stage, then from that stage, change it back to restart the previous stage, otherwise, it will error out at runtime.
- Along with other stages coming out of the Branch by stage action, add a stage that contains a Change stage action. Configure that action with the selected stage you would like to restart. In this image, the change stage action that is highlighted in the Restart Stage, is configured to change to the Review Request stage to start it over.
- If you have multiple stages that could be restarted, you can set a workflow variable to the name of that stage before that stage ends. In this image, the Set a variable value action is used within the Manager Review stage to store that stage's name in the variable, [Stage to restart].
Then configure a Change stage action to use that variable to direct the workflow based on the stored stage name.