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.

ADVERTISEMENTS

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:

  1. In SharePoint 2013, create a new SharePoint list named MyList that has one column named Title.
  2. 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.
  3. Create a local variable of type String named gotoStep.
  4. Add a Set Workflow Variable action to the SharePoint workflow, and configure it to say:

    Set Variable: gotoStep to Current Item:Title
  5. Click below Stage 1 to place the cursor, and then click Workflow > Insert > Stage to add a second stage to the workflow.
  6. Repeat the previous step to add a third stage to the workflow.
  7. 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
  8. 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
  9. 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
  10. 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.
  11. Repeat the previous step for Stage 3, but then set the Title to be equal to the text I am Stage 3.
  12. Add an End of Workflow action to the Transition to stage sections of both Stage 2 and Stage 3.
  13. Configure the SharePoint workflow to start automatically when an item is created.
  14. 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:

  1. Change Stage 1 to transition to Stage 2.
  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.
  3. Change Stage 2 to transition to Stage 3.
  4. Add an If-condition around the actions within Stage 3 to prevent them from executing if the gotoStep variable has a certain value.
  5. 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.

Related Articles

ADVERTISEMENTS