SharePoint Designer 2013 workflow goto step basics
Learn how to use the Transition to stage section of a Stage in a SharePoint Designer 2013 workflow to go to another Stage or another Step within the workflow.
New in SharePoint Designer 2013 are Stages with a section called Transition to stage.
Stages stand independently so cannot be included in other Stages. The way to execute actions from a particular Stage would be to use a Go to a stage action at the end of a Stage.
Stages can contain one or more Steps and each Step can on its turn contain one or more Steps.
The Go to a stage action cannot be used to transition to a particular Step in another Stage. However, you can make use of workflow variables to regulate the transition between Stages and Steps.
Go to a Stage from the currently executing Stage
To transition to another stage from the current stage:
- In SharePoint 2013, create a new SharePoint list named MyList that has one column named Title.
- In SharePoint Designer 2013, create a new List Workflow that runs on the MyList SharePoint list. Name the workflow GotoStepWF and leave SharePoint 2013 Workflow selected as the Platform Type.
- Create a local variable of type String named gotoStep.
- Add a Set Workflow Variable action to the SharePoint workflow, and configure it to say:
Set Variable: gotoStep to Current Item:Title
- Click below Stage 1 to place the cursor, and then click Workflow > Insert > Stage to add a second stage to the workflow.
- Repeat the previous step to add a third stage to the workflow.
- Click in the Transition to stage section of Stage 1 to place the cursor, add an If-condition to the workflow, and configure it to say:
If Variable: gotoStep equals Stage 2
- Click to place the cursor in the If-branch of the condition, select Workflow > Insert > Action > Go to a stage, and configure the action to say:
Go to Stage 2
- Click to place the cursor in the Else-branch of the condition, select Workflow > Insert > Action > Go to a stage, and configure the action to say:
Go to Stage 3
- Click to place the cursor in Stage 2, add an Update List Item action to the SharePoint workflow, and configure it to say:
Update item in Current Item
where you must set the value of the Title field to be equal to the static piece of text I am Stage 2.
- Repeat the previous step for Stage 3, but then set the Title to be equal to the text I am Stage 3.
- Add an End of Workflow action to the Transition to stage sections of both Stage 2 and Stage 3.
- Configure the SharePoint workflow to start automatically when an item is created.
- Publish the workflow to SharePoint 2013.
In SharePoint 2013, navigate to the MyList SharePoint list and add an item to it that has its Title set to Stage 2. Wait until the workflow has run and completed, and then check whether the text I am Stage 2 appeared in the Title field. Repeat the process but enter anything that is not Stage 2 this time, and then check the results.
Go to a Step from the currently executing Stage
Because SharePoint Designer 2013 does not offer the possibility to transition to a particular Step, you must instead transition to the Stage that contains the Step you want to go to.
For example, if you add a Step to Stage 2 in the solution described in Go to a stage from the currently executing stage, you could keep the solution as is; or:
- Change Stage 1 to transition to Stage 2.
- Add an If-condition around the Step within Stage 2, so that the actions in the Step are only executed if the gotoStep variable has a certain value.
- Change Stage 2 to transition to Stage 3.
- Add an If-condition around the actions within Stage 3 to prevent them from executing if the gotoStep variable has a certain value.
- Let Stage 3 end the workflow.
While the solutions described above have been kept pretty simple, you can use variables in a workflow to regulate as complex logic as you like.
- Create a simple SharePoint Designer 2013 workflow
- Create a SharePoint Designer 2013 reusable workflow
- SharePoint Designer 2013 workflow loop basics
- SharePoint Designer workflow string actions
- How to perform date calculations and construct dynamic strings in a SharePoint Designer workflow