There are a number of enhancements that have been added in SharePoint Designer 2013, which provide new functionality as well as streamlining the workflow development experience. These added features allow designers to do more with workflows without requiring a developer to write custom code. Please note that this article was written based on the Public Beta of SharePoint Designer 2013, so there may be discrepancies when RTM hits.
Changes/New Features in Text-Based Designer
How you design workflows using the text-based designer has changed a bit for SharePoint Designer 2013. Please note these changes are only for workflows based on the 2013 platform – if you create workflows based on the 2010 platform, these new features are not available.
Microsoft has introduced the concept of stages. These are containers in the workflow that allow you to structure the workflow to flow from one stage to another. The use of stages mean that you can create a workflow very similar to a state machine workflow (which is why we don’t have state machine workflows in 2013, per se). A stage can be added to a workflow by clicking on the Stage icon in the ribbon (under the Insert section):
This displays a box on the design canvas, which allows you to add workflow actions for that stage. All actions in the workflow must be contained in a stage (there are a few conditions that can reside outside of a stage).
A stage can hold one or more workflow actions, and will also have only one Transition to stage area. The Transition to stage area defines how the workflow exits the stage after its actions have been processed. The stage can be configured to transition to another stage, or to end the workflow. All workflows must have at least one stage, and it is not possible to nest stages in a workflow.
One of the major limitations in SharePoint Designer-based workflows in SharePoint 2010 was the inability to loop in workflows. 2013 workflows in SharePoint Designer can now include looping. There are two types of looping available: Loop n Times and Loop with Condition.
The Loop n Times loop type allows a designer to create a looping condition where the actions contained in the loop container are executed a number of times. One or more workflow actions can be placed in the loop and the workflow will execute these actions (in order) for the number of loop iterations specified.
The Loop with Condition loop type allows a designer to create a looping condition where the actions contained in the loop container are executed until a specified condition is met. Just like the Loop n Times loop type, the workflow actions placed in the loop will execute in order, and the loop will continue to execute these actions until the loop condition is met.
There are some restrictions when using loops:
- Loops must be contained within a stage
- You cannot add a stage inside a loop
- Loops can only have one entry and one exit point
Nested loops are also supported if the need for executing a series of actions in an inner loop is desired.
There are a few new actions in SharePoint Designer 2013 that can be used when designing workflows.
Assign a Task
This action creates a 2013 task in SharePoint and assigns it to a single user. Select the Assign a Task menu selection under the Action button from the ribbon to add this action to a stage in a workflow.
Adding this action to a workflow allows a designer to create a single task, assign it to a specific user, and save the Outcome and TaskID values to workflow variables.
Clicking on the this user hyperlink in the action will display a dialog that allows selection of the task participant, along with other details.
Start a Task Process
This action is identical to the Assign a Task action, with the difference being that multiple participants can be assigned to the task being created. The participants can be assigned to the task one at a time (serial, meaning the first participant must respond to the task before the next participant is assigned,
etc.), or all participants can be assigned to the task at the same time (parallel).
Call HTTP Web Service
This action allows you to call a REST-based web service without writing custom code. You specify the URL to the web service you wish to call, along with the HTTP method (GET, PUT, POST, DELETE).
New for designing workflows in SharePoint Designer 2013 is the Visual Designer. This designer is only available for workflows on the 2013 platform, and you will need Visio 2013 Professional installed on your PC to have this available in SharePoint Designer.
When creating a workflow, you can switch to the Visual Designer by selecting it from the ribbon:
This will switch your view of the workflow you are designing to a view that looks much like a diagram in Visio:
One of the first things you should notice is that there is a design surface for the stages and actions of your workflow, and a stencil pane (on the left) that you can drag-and-drop shapes to the design surface. Microsoft has taken the approach of making this design experience as close to designing diagrams in Visio, so if you are familiar with that tool, much of this will also be familiar.
When designing your workflows in the Visual Designer, you will notice that as you drag-and-drop shapes on the design surface, icons will be placed on the surface and will correspond to the shape you select. Depending on what shape you are adding, there may be additional information or properties you need to configure. For example, the shape to Create List Item requires that you select what list the item is being created in, along with what fields to set specific values for. Accessing the shape’s properties is done by hovering over the lower left corner of the shape.
A context menu will appear, allowing you to select the appropriate selection to get to the properties are you need to (different shapes will have different selections in the menu). In the example of the Create List Item shape, selecting the Item context menu item opens a dialog that allows you to select the list to create an item for, and also allows you to configure what fields to provide field values for, when creating the list item.
You are not restricted to only using shapes from the SharePoint 2013 workflow stencils, but if you use other shapes and attempt to connect them to your workflow, you will get a validation error stating that only SharePoint workflow-based shapes can be attached to the workflow. This validation occurs when you switch views, as well as when you press the Check for Errors button on the ribbon.
This view provides a high-level view of all the stages in your workflow, so you can get a view of the “big picture” of how your workflow is designed. This view doesn’t show the individual shapes in the stages, but you can press “Ctrl-Click” on a stage to be taken to the Visual Designer view for that stage. This view also requires Visio 2013 Professional to be installed to be available.
Importing/Exporting to Visio 2013
SharePoint Designer 2013 allows you to export your 2013 platform-based workflows as Visio 2013 diagrams, so that you can design them using the Visio 2013 tool. Alternatively, if you are more comfortable with designing workflows with Visio 2013, you can create your workflow in Visio and import it into SharePoint Designer 2013 when you are ready to add the workflow to your SharePoint environment.
Exporting a Workflow to Visio
Exporting a 2013 platform-based workflow can be done from any of the three designer views (Text, Visual, or Stage) by selecting the Export to Visio button from the ribbon. This will save the workflow and prompt the user to select a location and filename for the saved file.
Importing a Workflow from Visio
If you’ve created a SharePoint 2013 workflow in Visio 2013, you can import it into SharePoint Designer 2013. This is done by clicking on the Import from Visio item in the ribbon, when viewing the available workflows in your SharePoint site. You have the option of importing a 2010 or 2013 Visio diagram.
If you are importing a new workflow, SharePoint Designer will prompt you for information to create the workflow in the SharePoint site (such as the workflow name, the type of workflow, etc.) before it actually imports the workflow. If you are importing a pre-existing workflow (from a previous export), SharePoint Designer will ask if you want to overwrite the version that is already present in SharePoint. Please note that when importing new workflows, you will have to finish the configuration of any actions, such as selecting the text for the Add a Comment action. You only have the ability in Visio to design the stages, actions and steps for the general layout of your workflow. Any additional “wiring up” of the actions for the workflow must be done in SharePoint Designer.
SharePoint Designer 2013 has been enhanced to “raise the bar” for workflows, so that you can create more powerful workflows without having to move to fully custom workflows, requiring a developer. The integration of the Visio design surface for designing workflows is a major improvement in the workflow design experience, as is the added workflow functionality now available (looping, etc.).