SP2010 Workflow Template Validation Rules and limitations of the Visio-driven workflow model

I have been looking into the new SP 2010 Workflow Template that comes with Visio 2010 Premium with the intention of building complex workflows entirely within Visio and then exporting to SP Designer for implementation.

Sound easy? Well everything works fine if you plan to use the default shapes provided by Visio (and map to SP Designer default actions/conditions). Using these you can build workflows as complicated or simple as you like and have full synchronization to and from SP Designer.

The problem with this method is that you are limited to the default actions and conditions that ship with the product. Now granted this default set is better than 2007’s offering but there will certainly be lots of cases where the default set simply does not do the required job and a custom action or condition is required.

Custom actions and conditions can used easily within SP Designer and work really if your building your workflow there but if your planning to import and use those custom actions in your Visio model then you might want to re-think your strategy. Visio will allow you import these custom actions and they are shown with their own shape but you are unable to reuse these custom shapes in other parts of your diagram.

How does it Visio block you from doing this?

Well if you look at the validation rule set for the SP Workflow template using the bVisual Validation Explorer from  David Parker– the SharePoint template has the following rules

ID Name Description
1 MultipleStartWorkflows The diagram must only have one workflow and one start shape
2 NoStartShape The workflow must have a start shape.
3 InvShapeType The shape is not a SharePoint workflow shape. Only SharePoint workflow shapes can be connected in a workflow.
4 ConnectonToParent Loop back to parent shape is not allowed.
S OrphanConnector The connector must be connected to two workflow shape.
6 TerminateHasChildren The terminate shape must not have outgoing connection.
7 NoIfElseBranches The condition shape must have at least one outgoing connection with label Yes or No.
8 NofElseValue The condition shape does not have connectors labelled with Yes or No.
9 StartHasParent The start shape must not have incoming connections.
10 SequentialParallel Parallel activities that are also sequential are not allowed.
11 DuplicateConnections Duplicate connections exist between workflow shapes.
12 NestingDepth Workflow nesting levels must not exceed a maximum of 10
13 CompoundCondition A compound condition cannot be manually added to a workflow diagram. The compound condition can only be generated when importing workflow from SharePoint Designer.
14 CustomAction A custom action cannot be added to a workflow diagram. The custom action can only be generated when importing workflow from SharePoint Designer.
15 UnconnectedWorkflowShape The workflow shape is not connected to the workflow.
16 NoTerminateShape The workflow shape is not connected to a terminate shape
17 InvalidConnector The connector is not a SharePoint workflow connector. Use AutoConnect or the connector tool to connect your shapes.
18 CustomCondition A custom condition cannot be added to a workflow diagram. The custom condition can only be generated when importing workflow from SharePoint Designer.

The rule that we encounter when trying to reuse custom actions in your Visio model is Rule #14 ‘Custom action cannot be added to workflow diagram..’ (see table above).

So the rule set is preventing the reuse of custom actions/conditions for some unspecified reason. I’m sure there is a valid reason for blocking this (maybe the Visio team simply ran out of time?) but the rules are customisable, so you should just be able to edit or override the rule and be done with it, right?

Well no actually. As it happens there are two methods of performing diagram validation using Visio 2010 – deploying the rule sets into the Visio template or writing a Visio solution and burying the logic within the code to fire on the RuleSetValidated event (more info on the Visio Team Blog). Unfortunately for those of us wanting to customise the SharePoint validation rules the SP Workflow template uses the latter method and we are unable to view / modify the logic.

So if you are planning to develop complex and powerful workflows for SharePoint 2010 then you might want to rethink your approach and decide whether you will need to use custom actions / conditions or whether the default set will suit your purpose.

Having said this, it is still possible (and very useful) to use custom actions / conditions and build your workflow entirely within SP Designer then export out to Visio for workflow visualisation. This way you will have accurate workflow representation including all custom actions / conditions but you will not be able to make changes within Visio – it must be done at the SP Designer level.

I intend to look further into this matter to see if there is some way in which custom actions / conditions can be reused  and Visio be leveraged for complex workflow design so look out for updates in this space shortly.

Update 1: Nothing so far from TechNet forums but I’m  awaiting a response from Microsoft to see if there is anyway around this issue.


Filtering Lists based on shape selection using Visio Web Access

I’ve been looking into the options of using Visio Web Access to link Visio objects to SharePoint data. Now that its possible to capture shape data and use it to filter web parts there is a an opportunity to supplement Visio diagrams with contextually relevant information.

In my example I want to show how it is possible to use the selected Visio shape to filter a SP list to display contextually relevant information on the fly.

The list I have created has supplementary information that might be useful to the diagram – please note I made it up very quickly and should not reflect any system design! You can mock-up something similar to the list shown below or anyones interested I could upload it as a list template – just ask.

For this example I have also created a very simple Visio diagram of ‘entities’ which we are going to use as our filter criteria. Create a new Visio diagram and drop on a couple of shapes – it really doesn’t matter what type they are.

The main thing here is the Shape Data – if you are familiar with adding Shape Data  simply define a new data property called ‘Entity’  and type the entity name into the shape information panel.  For those you don’t know what I mean by this, see the steps below.

Right click the shape and select ‘Define Shape Data’. Remove any existing data properties and add a new one called ‘Entity’ as per the diagram below (removing the ‘Order’ text under Value as this is specific to the shape and is added in a later step).

Now with the ‘Shape Information Panel’ you should see the ‘Entity’ data property with a blank value and you can enter the entity value for each shape – which in this example is the same as our shape name. If you don’t know where the Shape Information Panel has got to, enable it by selecting ‘Task Panes -> Shape Data’ from within the ‘View’ ribbon.

At this stage you are possibly wondering why you can’t simply use the Shape Name – doesn’t  the Visio Web Access surface this by default?

Well yes it does but in my tinkering I could not find a way for the Shape Name to correctly filter the list using the Shape Name and after many attempts decided to follow the approach of using custom shape data. If you have figured out a method of using the Shape Name to filter then I’d love to know – hopefully it’s not just something within my environment!

Before moving on make you to add entity values for all your shapes using the shape information panel.

Save the example diagram as a Visio Web Diagram (*.vdx) using the ‘Save As’ function and upload to a document library on SharePoint.  The source data is now created so move on to creating the page and making the filter connection.

Create a new page either using web interface or SP Designer and add two web parts: Visio Web Access and the list you created earlier. I will run through the web interface method below.

Select ‘Site Actions’ -> ‘More Options’ and select ‘Web Part Page’

Select ‘Full Page’ Filtering as your layout, enter a name for your page and click ‘Create’

You will be looking at a blank web part page with a big button to ‘Add a Web part’.

First add the ‘Visio Web Access’ web part which will act as your placeholder for your Visio diagram.

Click the link that says ‘Click here to open the tool pane’ and either paste in the Web Drawing URL to the saved .vdx you uploaded earlier or navigate to it like below.

QUICK TIP: The ‘Override Web Drawing’s default initial view’ option in the web part settings (second configuration option) should be disabled if you are using a diagram with multiple tabs. Despite what you might infer from its name, when enabled, it always refreshes the diagram back to the first tab with each shape selection. My suggestion is to disable this option unless you specifically need the functionality or are using a diagram with only one tab.

The other web part option that needs to be set before we can move on is the ‘Expose the following shape data..” field.

Because we are using custom shape data to filter (i.e. not Shape Name, Shape ID etc) we need to tell the web part to expose this data in order to use it in our connection. In this field type in ‘Entity’ if your following my example, or the name of the data property you created in Visio. We can now use this value to send as a filter to our list web part.

The go back and add another web part for the list you created earlier. This is done by selecting the list from ‘List and Libraries’ Category. It must be pointed out that the list must exist in the same site for this method to work. If your list is in another location or SP Farm then you will need to build a Data View Web Part like I have run through in this article.

Now that both elements are on the page we can set up the web part connection to send the filter value from one to the other.

Make sure the page is in edit mode and select the web part settings drop down for the Visio Web Access web part and select ‘Connections’

The connection type we wish to make is the ‘Send Shape Data to’ which will send the value of the selected shape to the list.

This will bring up a new window with the two-step connection wizard.

Select the ‘Get Filter Values From’

Then select ‘Entity’ in both the provider and consumer field. Essentially you are defining what value is being passed from the Visio web part (in this case our entity shape data value) and the consumer field defines what column on the list is to be filtered based on this value (and again in this example it is also the entity column).

Now the connection is set up, when we select a shape on the diagram it passes the entity name from the shape data to list web part and filters the list accordingly.

In my example I’ve attempted to show how web part connections can be used to supplement an entity relationship style diagram with information from a SP list but this is just one of many possible applications. Now that you can capture ANY type of shape data and pass this to ANY web part – the doors really do open.

Currently I am looking into a documentation system that uses such references to make a set of interactive, highly linked and contextually relevant document with as little content management as possible. I will post more in this space as it progress but this article should prove to be a useful starting point.

Referencing lists from external site collections – Cross-site collection lookup with REST and the DVWP!

The inclusion of REST in SP2010 has given us an easy way to reference lists external to the site collection – and cross-site lists too of course! The purpose of this post is to give a quick run down on creating the REST connection as data source and building a data view web part to display the result. The post is probably aimed more towards a non-technical audience but may prove useful for developer / consultant types.

First thing to note is REST must be enabled on your environment so before you go any further, check that the service is running through your web browser. To do this, simply paste the following into your browser and replace the bracketed variables with your SP URL and the name of the list you wish to use.


If that returns a result in browser that looks strikingly like an RSS feed – then great, the service is working. If not, then ask your SP Admin nicely to get REST enabled (or have a go yourself if you have access) and the SPDevWiki has a good article on how to do so here

Techy note: As an alternative to REST you can follow the same principles of this article and use a the list.asmx web service and a SOAP connection as your data source. Personally I find this method easier to build your data view web part but both methods have their merits.

So assuming REST is enabled – we will move onto creating the connection into SP Designer.

First, open up SP Designer and go to the data source window.

Select ‘REST Service Connection’ from the ribbon to create a new REST query. On the ‘General’ tab enter a relevant name and then on the ‘Source’ tab under ‘Select Connection Info’ use the following syntax to specify the URL:


Replace [yoursharepointURL] with your address and [LISTNAME] with the name of your list.  Randy Williams has a good article on using REST in SharePoint 2010 so check that for further information.

The main thing to understand here is the structure of the URL and how to define which list it points to. The intention of this article is to explain how to reference a list on a different site collection but you could use any REST enabled data source for the same purpose.

An issue I encountered when playing around is that windows authentication didn’t seem to work when trying to build a data view web part – so if you encounter this then I suggest specify your domain account in the ‘Login’ tab. See my brief post on this here.

The next thing to do is create a blank web part page in order to display the new data source. Go to the ‘Site Pages’ library or any pages library within your site and select ‘Web Part Page -> Blank Web Part Page’ from the ribbon as shown in the screen below.

Now add the data view web part to the empty web part zone. Make sure the focus is in the web part zone in order to see the ‘Insert’ ribbon.

From the ‘Insert’ ribbon select the ‘Data View’ button and then ‘Empty Data View’. You could select the REST connection by scrolling down the drop down list but I had a few issues with that and prefer to define it in a second step – if it works for you then by all means do it!

If you followed my method of adding an empty data view web part then you see a web part like this.

Right click the web part and select ‘Select a Data Source’ from the context menu.

Now select the REST connection to add the data connection to the Data Source details panel and begin building the data view.

If everything went smoothly then you should see a data in the data source details panel similar to my screen below. If you encountered a ‘non-specific error’ then please see my short post here and force the connection to use your credentials and not windows authentication. I haven’t seen a way around this as yet but will keep an eye out.

Now the data connection is setup it’s just a matter of selecting what fields to display on the web part. There are two ways of doing this and it should be a matter of preference as to which you use – either select ‘Add/Remove Columns’ from the ‘List View Tools – Options’ ribbon or select the columns from the data source details panel and drag them onto your web part.

You should end up with a data grid similar to the mine below depending on how many columns you selected and the structure of your data.

How you build your data view depends the structure of your source data and it’s beyond the scope of this article to detail the various methods but the point here is we have the ability to use data from a list external to the site collection. This is a big plus if your environment has multiple SharePoint deployments for various functions such as a corporate intranet and an Office Business Application (OBA) – and you need to lookup data between them.  It also provides an easier way to reference lists cross-site and I find this method easier than using SharePoint’s lists.asmx web service and SOAP – but that may just be a personal preference!

Hopefully the post is useful to those who haven’t worked with the data view part before and for those who have – hope there weren’t too many screen clips!

As always feedback and questions are more than welcome!

Non-specific error trying to get the data source – REST and SP2010.

I’ve been playing with the REST protocol in SP2010 to bring in data from external lists (external to the site collection) and using it to display the result in the data view web part (DVWP).

Creating the data source went smoothly but when I tried to use it in the DVWP it threw the following unhelpful error.

“The server returned a non-specific error when frying to get data from the data source. Check the format and content of your query and try again. If the problem persists, contact the server administrator.”

I checked the service in the browser and it was working fine – so a quick investigation identified authentication as the problem. I went back to the data source and forced the service to  use my domain account instead of the default windows authentication provider.

As soon as the authentication was forced and I refreshed my data connection – the DVWP pulled everything through perfectly.

This issue seems to be with SP Designer not recognising your domain account when using windows authentication. This work-around will do the job – although it must be pointed out this method sends your credentials unencrypted in the call. Not the type of thing you would put into a production environment but will at the very least get you up and running with REST services inside SharePoint 2010.

More to come on this topic soon, specifically around potential uses of the service and a detailed walk through (time permitting as always!)

Add Images directly into a list on the fly in SP2010 (and store in central asset library)

Ever found it incredibly annoying when trying to add images into a list on the fly? (without having to go away and add them to a library first – then come back and manually add a reference).

Using SP2010’s enhanced rich text field, you can upload and add an image directly into the list without having to leave the page.

When editing the enhanced rich text field (whether editing a single item in the edit form or using the cool new ‘Inline Editing’ feature (explained here), you have the option to insert from the ‘Editing Tools’ menu.

This brings up the ‘Select Picture’ dialog where you can select a local image to upload and a library to stored the uploaded copy.

Then save the uploaded image and complete any metadata requirements.

The image is inserted into the SP list but is managed centrally within the chosen library.

A very handy feature that was missing from 2007 and I’m glad it has been addressed in 2010.

Splitting large SP2010 workflows in Visio 2010

Just a short post on how to approach designing and implementing large or complex workflows using the SharePoint 2010 workflow template in Visio 2010 Premium.

As you probably have heard Visio allows us to use this template to model our SharePoint workflows in Visio with a new shape set and then export it directly(as a zipped XML, *.vwi file) into SP Designer for the developers to ‘hook up’.

I am currently modelling quite a complex / large workflow and I can see its going to be an absolute beast to contain within a single, sprawling Visio workspace. After talking with the development team it was decided that breaking out into ‘tabs’, although not as powerful as the linked sub-process of standard models, would be sufficient for development.

Rather than exporting and maintaining as a single .vwi file, the ‘export’ option of the process tab only exports the contents of the current tab – so it is possible to break detail out into ‘tabs’ and export as separate .vwi files, which in turn are imported and implemented into SPD.

You wont get as much detail in your workflow visualisation if you implement in this manner, but you could always link the tabs or .xml in the .vwi’s together at the end to get a single (if not complex) workflow visualisation.

Will post more on SP2010 workflow design in Visio as I come across – which be the looks of things, will be a lot!

How the SharePoint 2010 Workflow Visio Template Shapes translate to SP Designer workflow steps

I’ve been working on designing a comprehensive workflow for a new application with the SharePoint 2010 workflow template for Visio 2010 Premium. I’ve already modeled the process flow in UML and looking to design it with the template in order to keep it maintainable and customizable moving forward. I googled around and there isn’t a lot of content in this area yet and I wanted something to assist my shape-choosing process. I created a dummy workflow with every single shape and imported the Visio Workflow Interchange (*.vwi) into SharePoint Designer to see exactly what steps each shape mapped into. Rather than store this for my own selfish benefit, I thought others may benefit from seeing what their shapes translate to in a SP Designer context.

Actions Table

Visio Shape Action / Condition Name SharePoint Designer Workflow Steps

Start Obvious one – sets the start point for the workflow to begin
Assign a To-Do item Assign a to-do item to these users
Collect data from a user Then Collect data from this user (Output to collect)
Start approval process then Start Approval (4) process on this item with these users
Start custom task process then Start Task (9) process on this item with these users

Start feedback process then Start Feedback (2) process on this item with these users

Send an email then Email these users

Add a comment then Comment: comment text

Add time to date then Add 0 units to date (Output to date)

Do calculation then Calculate value this operation value (Output to Variable: calc)

Log to history first then Log this message to the workflow history list

Pause for duration then Pause for 0 days, 0 hours, 0 minutes

Pause until date then Pause until this time

Send document to repository then Submit File using this action to this destination router with this explanation (Output to submit file result)

Set content approval status then Set content approval status to this status with comments

Set field in current item then Set field to value

Set time portion of date/time field then Set time as hours: minutes for date (Output to date)

Set workflow status then Set workflow status to Cancelled

Set workflow variable then Set workflow variable to value

Stop workflow then Stop the workflow and log this message
Wait for field change in current item then Wait for field this test value

Send approval for document set then Start New Task (2) process for the contents of this Document Set with the users specified by this column

Send document set to repository then Submit Document Set using this action to this destination content organizer with this explanation (Output to submit file result)

Set content approval status for document set then Set content approval status for the contents of this Document Set to this status with comments

Check in item then Check in item in this list with comment: comment

Check out item Then Check out item in this list

Copy list item then Copy item in this list to this list

Create list item then Create item in this list (Output to create)

Delete item Delete item in this list

Discard check out item Discard check out of item in this list

Add list permission then Add these permissions to item in this list

Inherit list item permissions then Inherit parent permissions for item in this list

Remove list item permissions then Remove these permissions from item in this list

Replace list item permissions then Replace these permissions of item in this list

Update list item then Update item in this list

Look manager of a user then Find Manager of this user (output to manager)

Assign a form to a group then Assign a custom form to these users

Terminate Ends the workflow.

Conditions Table

Compare data source If value this test value

Compare document field If field equals value

Title field contains keywords If title field contains keywords

Created by a specified person If created by specific person

Check exact user permissions If permission levels for these users are at least these permission levels on item in this list

Check user permissions If permissions for these users are at least these permissions on item in this list

Created in specific date span If created between date and date

File size is in a specific range If the file size is between size and size kilobytes

File is a specific type If the file type is specific type

Modified by a specific person If modified by specific person

Modified in a specific date span If modified between date and date

That satisfies my needs at the moment but if I get time I’d like to add some detail and screen grabs to the mix. Feedback and questions are both more than welcome!

Update #1: After some feedback from readers I decided to add the workflow shapes into the table.. formatting isn’t the prettiest but should act as a nice reference chart for those us charged with creating Visio workflows for SharePoint.

Let me know if there is any other features you’d find useful – feedback has been very positive so far!