Partilhar via


Creating a SharePoint 2010 Workflow using SPD 2010 and Visio 2010: How-To & FAQ

Sam Chung-Hello all, my name is Sam Chung and I’m a PM on the SharePoint Designer team. In this blog I’m going to talk about how you can use Visio 2010 and SPD 2010 together to create workflows. In addition, I’m going to touch base on some common issues and questions people run into when using the two tools together.

To set the stage we need some context regarding the relationship between SPD and Visio. There are already a number of resources out there regarding how you can use the two together. In particular the follow blog entries describe this from Visio’s side:

https://blogs.msdn.com/b/visio/archive/2009/11/23/sharepoint-workflow-authoring-in-visio-premium-2010-part-1.aspx

https://blogs.msdn.com/b/visio/archive/2010/01/19/sharepoint-workflow-authoring-in-visio-premium-2010-part-2.aspx#comments

However, as the above blog posts are quite dated, I’ve decided to bring a fresher relook at using the two together. In addition, I will be diving a bit deeper into some areas, and going over some common issues people have already been hitting.

Background

For this blog I’m going to assume you haven’t seen any previous information relating Visio and SPD, and as such, I’m going to set some background. If you’re already fairly familiar Visio and SPD I’d suggest you skip this section and move onto the next sections.

The SharePoint Designer 2010 team has partnered with Visio to allow users the ability to use the two tools together in creating and viewing workflows. This blog will focus more on the creation piece of the partnership and will not touch too much on the server side visualization (let’s leave some stuff for another blog).

The creation of a workflow can now happen in two ways. Users can use the regular sentence based designer within SPD to create/edit workflows, or they can use Visio client. Since the creation of workflows within the Sentence based designer is something that is fairly well known, I’m going to concentrate on how users can use Visio Client to create and edit workflows.

**NOTE** You need to have Visio 2010 Premium to be able to do this. In addition, SPD 2010 and Visio 2010 must be installed together on the same machine

This partnership was created to help those who are more comfortable with Visio to be able to use a more familiar design surface. At the same time, the Visio design surface offers a very unique view of the workflow that many users may find useful when designing/reviewing workflows. Although the entire workflow cannot be created in Visio, users are still able to create the overall “flow” of the workflow and then finish setting the parameters within SPD.

Creating a Workflow Diagram in Visio

1. Start Visio 2010 Premium

2. Create a new Diagram

clip_image002

3. Under Template Categories, select “Flowchart”.

clip_image004

4. Then select Microsoft SharePoint Workflow

clip_image006

5. Press the Create button found on the right side.

clip_image008

***Note*** There is no difference between selecting US Units or Metric Units. Both will create the same workflow diagram.

6. You will be presented with a blank canvas. Before you start, you should know that you need to insert the Start Shape clip_image010 and End Shapeclip_image012.

· All SharePoint workflows need to have these shapes.

· All of the workflow shapes you add need to be inserted between these two shapes.

7. All of the workflow shapes have been organized into categories within the stencil pane.

clip_image013

· Quick Shapes – contain the shapes that are placed in the “top portion” within each of the different categories.

***Note*** Quick shapes are a great way of speeding up the workflow creation process. Every category within the stencil has a quick shapes section. For example, if you look the SharePoint Workflow Actions category, you’ll see how there’s a thin line separating the top set of actions from the bottom set of actions.

clip_image015

The actions located at the top are the “Quick Shapes” for that category. Quick Shapes are not automatically selected based off usage or anything like that. Instead, the shapes in this section are simply user settable. Go ahead and click and drag any shape you want above the line and that shape will become part of the quick shapes list. You can then use these shapes to help create your diagram a lot quicker. The top four quick shapes will appear as ghosted option on shapes within the canvas. (Simply mouse over the light blue arrow heads on the side of any shape to see this)

clip_image017

· SharePoint Workflow Actions (XXX units) – is where all of the SharePoint Workflow actions are stored

· SharePoint Workflow Conditions (XXX units) – is where all of the SharePoint Workflow conditions are stored

· SharePoint Workflow Terminators (XXX units) – is where you will find the Start and End workflow shapes that I described in step 6

***Note*** The SharePoint Workflow Actions shown in the stencil pane are not filtered based off the type of workflow you would like to create. Normally, when you create a workflow in SPD, the list of actions you are presented with is filtered to just the set of actions that are relevant to the type of workflow you are creating. So if you are creating a List workflow you will only see list workflow actions, this is the same for the site workflows and reusable workflows. However, in Visio client there is no filtering on the list of actions made available to you. As such, when creating workflows using Visio, you will need to make sure that you only use actions that are relevant for the type of workflow you are creating.

In addition, none of the site workflow specific actions are available here. As such, you will not be able to create Site Workflows using Visio Client. During Import you will notice that there is no option to create site workflows based off a Visio Diagram.

8. Go ahead now and add the shapes you’d like and create your workflow. For this blog I have created a very simple example.

clip_image019

***Note*** Don’t forget to set the Yes/No options on all conditional shapes. A quick way to do this is to just right click on any of the connectors coming out of a conditional shape and select “yes” or “no”.

Exporting / Importing between Visio and SPD

By this point you are trying to get your Visio Diagram from Visio to SPD. The next couple sections will cover the best ways to do this.

Going from Visio to SPD

1. Once you have created your diagram and you’re ready to send it to SPD you need to first press the “Export” button

· This button is found in the “Process” tab

clip_image021

2. If there are errors within your diagram they will appear in the error pane.

clip_image023

***Note*** Visio at this point in time is checking to make sure that the diagram you are trying to send to SPD is a diagram that can be converted directly into a workflow. But it is only checking between the start clip_image025 and end clip_image027 shapes. Everywhere else is fair game for you to place whatever Visio shapes you may want. Just make sure that everything between the Start and End shape are workflow shapes, and that they are connected properly.

3. Assuming the validation passed (if it didn’t pass, and you have errors, go fix the error first and then come back) you’ll be presented with an Export Workflow dialog where you can specify where you want the VWI file saved. Select a location, name your file and press Save (I called mine “Simple Workflow” and saved it on the desktop).

***Note*** The VWI you are saving represents an Open XML file, basically a zip file, that contains several other files within it. You can go ahead and use your favorite zip program to unzip the file and take a look at what files exist within it. But generally, you will find the following files:

[content_types].xml

Workflow.vdx

Workflow.xoml

Workflow.xoml.rules

In general, the ones you will care most about are the .vdx file and the .xoml files. The vdx file is the Visio diagram you just created. And the .xoml files represent the actual workflow xoml that would be run once the workflow is published. Right now, the .xoml files won’t have much in them because this workflow hasn’t been properly configured yet in SPD. But once we finish configuring this workflow and if we were to export out the workflow again from SPD you would see a lot more info in the .xoml files. You’d also see a workflow.config file that outlines additional details regarding the workflow. For now, let’s not mess with these files and just move on to the next step.

If you would like to learn more about Open XML files, please refer to the following link: https://msdn.microsoft.com/en-us/library/aa338205(v=office.12).aspx

4. Now let’s go ahead and Import in that VWI file into SPD. Open up SPD, and connect to your most favorite SharePoint 2010 site.

5. Next click on the Workflow Link found on the left navigation bar

clip_image029

6. Next go to the ribbon and press the “Import from Visio” button

clip_image031

7. This will bring up the Import Wizard. Go ahead and first select your VWI file, and press the next button

clip_image033

8. Give your workflow a name and select what type of workflow it is.

clip_image035

9. If everything has gone correctly you should see something like below:

clip_image037

Modifying the Workflow

1. You can now go ahead and start setting the parameters for each of the actions within the workflow. Once you’re done, your workflow might look something like below:

clip_image039

2. Now before you publish, let’s add another action to the workflow. I inserted a simple log to history action to the end of my workflow.

clip_image041

***Note*** Now this is a really important note. If you’re going to be adding/deleting/moving actions within your workflow, there is a very good chance that the diagram you initially started out will NOT look the same when you view it in the server side visualization. This is because when you modify action locations within SPD, the Visio Add-on inside of SPD needs to dynamically recreate the diagram and relay out the entire diagram. This means that things might look different from what you would have expected. As such, if the server side visualization is important to you, you should:

a) First Export the workflow from SPD back to Visio

b) Fix the diagram

c) Export out from Visio to SPD

d) Republish the workflow (without modifying it again in SPD)

3. Go ahead now and publish your newly created workflow.

Conclusion

Well there you have it, a quick and tightly integrated experience going from Visio to SPD. Hopefully this has been of some use to you. I’ve gone and consolidated the notes from above into a FAQ / Tips section below.

Please feel free to post questions below. I’ll try and respond to the questions as much as possible.

In addition, hopefully in the next couple weeks I will create another short follow up blog post describing in detail the experience of going from SPD to Visio, along with issues that can arise when trying to update an already existing workflow with a Visio diagram.

Thank you everyone for reading.

Sam

FAQ And Tips & Tricks

1. You need to have Visio 2010 Premium to be able to create SharePoint 2010 workflows. In addition, SPD 2010 and Visio 2010 must be installed together on the same machine

2. When creating a new Visio SharePoint 2010 Workflow Diagram, there is no difference between selecting US Units or Metric Units. Both will create the same workflow diagram.

3. Quick shapes are a great way of speeding up the workflow creation process. Every category within the stencil has a quick shapes section. For example, if you look the SharePoint Workflow Actions category, you’ll see how there’s a thin line separating the top set of actions from the bottom set of actions.

clip_image042

The actions located at the top are the “Quick Shapes” for that category. Quick Shapes are not automatically selected based off usage or anything like that. Instead, the shapes in this section are simply user settable. Go ahead and click and drag any shape you want above the line and that shape will become part of the quick shapes list. You can then use these shapes to help create your diagram a lot quicker. The top four quick shapes will appear as ghosted option on shapes within the canvas. (Simply mouse over the light blue arrow heads on the side of any shape to see this)

clip_image017[1]

4. The SharePoint Workflow Actions shown in the stencil pane are not filtered based off the type of workflow you would like to create. Normally, when you create a workflow in SPD, the list of actions you are presented with is filtered to just the set of actions that are relevant to the type of workflow you are creating. So if you are creating a List workflow you will only see list workflow actions, this is the same for the site workflows and reusable workflows. However, in Visio client there is no filtering on the list of actions made available to you. As such, when creating workflows using Visio, you will need to make sure that you only use actions that are relevant for the type of workflow you are creating.

5. In addition, none of the site workflow specific actions are available here. As such, you will not be able to create Site Workflows using Visio Client. During Import you will notice that there is no option to create site workflows based off a Visio Diagram.

6. Don’t forget to set the Yes/No options on all conditional shapes. A quick way to do this is to just right click on any of the connectors coming out of conditional shape and select “yes” or “no”.

7. When trying to export out a diagram from Visio, Visio is checking to make sure that the diagram you are trying to send to SPD is a diagram that can be converted directly into a workflow. But it is only checking between the start clip_image043 and end clip_image027[1] shapes. Everywhere else is fair game for you to place whatever Visio shapes you may want. Just make sure that everything between the Start and End shape are workflow shapes, and that they are connected properly.

8. The VWI you are saving represents an Open XML file, basically a zip file, that contains several other files within it. You can go ahead and use your favorite zip program to unzip the file and take a look at what files exist within it. But generally, you will find the following files:

[content_types].xml

Workflow.vdx

Workflow.xoml

Workflow.xoml.rules

In general, you will care most about the .vdx file and the .xoml files. The vdx file is the Visio diagram you just created. And the .xoml files represent the actual workflow xoml that would be run once the workflow is published. The .xoml files won’t have much in them when exported from a new Visio diagram; this is because this workflow hasn’t been properly configured yet in SPD. But once you finish configuring this workflow and if you were to export out the workflow again from SPD you would see a lot more info in the .xoml files. You’d also see a workflow.config file that outlines additional details regarding the workflow.

If you would like to learn more about Open XML files, please refer to the following link: https://msdn.microsoft.com/en-us/library/aa338205(v=office.12).aspx

9. If you’re going to be adding/deleting/moving actions within your workflow, there is a very good chance that the diagram you initially started out will NOT look the same when you view it in the server side visualization. This is because when you modify action locations within SPD, the Visio Add-on inside of SPD needs to dynamically recreate the diagram and relay out the entire diagram. This means that things might look different from what you would have expected. As such, if the server side visualization is important to you, you should:

a) First Export the workflow from SPD back to Visio

b) Fix the diagram

c) Export out from Visio to SPD

d) Republish the workflow (without modifying it again in SPD)

Comments

  • Anonymous
    May 18, 2011
    I need to be able to copy the selected items from one list to another list and create an email that contains a list of the selected items. Can i do this using an SPD 2010 Designer worklflow? can you provide any guidance on how i can identify the items on the list that have been selected (selection checkbox checked). Thanks in advance.

  • Anonymous
    May 19, 2011
    The comment has been removed

  • Anonymous
    May 23, 2011
    Dean, If you would like to build and manage workflows that take advantage of looping (without reverting to coding in VS), you will need to consider a Business Process Management Suite that integrates with SharePoint.  There is a great Forrester paper available that explains you options for Microsoft-centric BPMS' that can be found here:  www.global360.com/.../sweet-spot.  The paper requires registration to download because Forrester makes us verify the # of copies distributed, but this is an independent view of the market -- i.e., we did not pay for this paper to be written. Derek

  • Anonymous
    May 24, 2011
    @Dean, as you know (we're discussing this over on the SPServices site right now), you can relatively easily do the sort of thing you describe client side with script.. For others, take a look at using <a href="http://jquery.com">jQuery</a> and <a href="http://spservices.codeplex.com">SPServices</a> rather than traditional .NET development to solve requirements like this. jQuery makes it easy to determine which items in a list view are selected with a selector like: <code>$("td.ms-vb-itmcbx input:checked")</code> Then you can use GetListItems and UpdateListItems to copy the selected list items from the first list to the second. M.

  • Anonymous
    December 07, 2011
    Hi Sam, why it is not allowed to add custom actions in Visio? What is the reason? Btw, we make a special add-in for Visio to support our actions: www.harepoint.com/.../conversion-workflow-authoring-in-visio-2010.png Hope, that in next SharePoint it will be more easy. WBR, Alexander www.harepoint.com

  • Anonymous
    July 30, 2012
    this nice post. it helps me to get easy. thank you