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.

Advertisements

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.

Visio Web Access in SP2010 – In-browser view of Visio diagrams with nice Silverlight UI

SharePoint 2010 brings to us some really nice Office web apps that allow in-browser rendering (and editing)  of Office 2007/10 formatted documents and I took a brief look at Word and its co-authoring functionality last year.

This time I’d like to demonstrate Visio Web Access and its nice Silverlight UI that includes features like linking to sub-processes, presentation of the shape data via the shape information panel and the ability to switch between tabs. Visio 2010 now comes with the web drawing format (*.vdw) allows any diagram to be rendered in-browser and is easily done using the  ‘Save As’ function and selecting the *.vdw format.

The Silverlight rendering allows the viewer to ‘zoom and pan’ around the Visio canvas, negating the need for scroll bars and allows large diagrams to be easily displayed on a single page.

It is hard to see from the static picture above but the user can easily drag around the interface, zoom in and out and interact with individual elements within the diagram. In the screen grab above the ‘Rule 2’ decision has a blue highlight indicating it has been selected and would display the shape information in the information panel.

The image below attempts to show the user panning to right hand side of the image and exposing the blank canvas at the top and right of the diagram.

The new ‘linked sub-process’ feature allows shapes to be linked to a sub-processes on a separate and Visio web access maintains this connection through hyperlinks. Using this technique you can have great click-through diagrams linking areas that previously were only accessible by manually switching tabs.

The Shape Information Panel displays shape and hyperlinks data for the currently selected shape.

There is also an option to open in Visio allowing you make edits and save changes back to the document library. These updates are reflected in the rendered version as soon as the document is checked back in to SharePoint. The same result can be achieved by uploading a new version of the .vdw and overriding the existing file.

Visio Web Access  renders tabs in separate canvases and provides a drop down control to navigate through the tabs provides an alternative to linked sub-processes  (although I suggest you utilise this where possible – it’s very user-friendly!). The above screen illustrates this control.

That was a quick look at Visio Web Access and I intend to return to the subject when I have explored the data linking and other cool new features available in SP2010.

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!

Using Visio Shape Reports to export detail from your diagrams

Ran cross another handy feature of Visio – Shape Reports!

If you’re like me and love manipulating data in Excel to clean up and use elsewhere, rather than doing it the long, slow and manual way, then you will probably like to explore this feature of Visio.

I recently created a state chart and I needed a quick export of all of the states I used on the diagram.

Sure, I could manually type them out, or individually copy and paste each one into a document, but that’s now how I like to operate! If there’s a tool for the job – I like to use it.

So I opened up the ‘Shape Reports’ option under the ‘Review’ ribbon and begin to design my extract.

We want to create a new report, so go ahead and click that to begin the new report wizard.

Now, depending on what you’re doing or what data you’re trying to extract out of your model, you can export everything (easiest – but takes longer to clean up) or put some criteria around what you want to export (little bit trickier but my favorite!)

Easiest option is to create an export using the ‘Shapes on the current page’ and click through the wizard with the default options  and selecting  ‘Show all properties’. This will give you a dump of all properties and you can filter through what you need in Excel.

Personally I like to extract just what I need from the model, so I set some export criteria using the ‘Advanced’ option on Wizard step numero uno.

Here you can define some conditions for what you want to pull out of your model. For the above example I’ve opted to ignore the transition shapes as I just want to see a list of state names.

Play around with what’s available, particularly under the ‘Master Name’ property, to find the criteria your after.

So proceeding with example of not including ‘transition’ elements, you can then move on to selecting what properties to export.

Again, depending on what your modelling and how you defined it, your requirements may differ here. In my example I’ll be using ‘Displayed Text’ – as that’s the exact data set I’m looking for.

Give your a report a name on the next step and then a report definition (for recognizing the report later on!).

Double click your newly created report to see the results.

You need to select an export format, as I said earlier, Excel is my personal favourite for manipulating large amounts of text and filtering – but the choice is entirely yours of course.

Voila! Your data is exported in a lovely styled format ready to use as you please.

I kind of skipped over the selecting the report criteria section, so if anyone would like more guidance in that area let me know!

SharePoint 2010 Workflows in Visio 2010 – A seamless integration!

I have been doing some analysis work on a new SharePoint 2010 implementation and have wandered across the new SharePoint workflow template in Visio 2010. It’s an area I briefly touched last year on the 2010 Beta but didn’t get much hands on time with.

I’ve had a quick play with the feature set and the template and wanted to share my findings and thoughts on the subject. A good search didn’t bring much info in the way of SharePoint / Visio 2010 so I will do my bit to contribute to the ever-growing pool of resources.

So as you have probably seem from the marketing guff and the PowerPoint decks, there is a new SharePoint workflow template available in Visio, with the intention of empowering the business analyst (or power user) to design or re-design workflows within Visio and have that exported directly into SharePoint designer.

The advantage here is all the developer needs to do is take the exported Visio process and connect up the data sources / lists to the appropriate places, and you have your working workflow. Easy as that!

There are some interesting discussions going around about the pros / cons of this, particularly around whether such users should be empowered to make these design-type decisions (or more accurately, whether developers should take the models and deploy them verbatim) but I will make my comments on this further after a brief primer.

You have probably seen the process before in presentations or similar blogs, but for those who haven’t, I’ll quickly run through the process.

First you select the ‘SharePoint Workflow’ template in Visio.

You then get a blank canvas and a raft of SharePoint-specific workflow shapes to choose from

They are set out in normal style: actions, conditions and terminators.

Drop the shapes as if you doing a standard process flow and then run the validation rules.

Under the ‘Process’ ribbon, select the ‘Check Diagram’ option.  Generally you need to avoid things like looping back to parent shapes and ensuring all decision points have a Yes / No branch.

Below is an example of a validated workflow.

Once your workflow is validated, it is then exported into a Visio Workflow Interchange file (*.vwi) before being imported into SharePoint designer.

To export your Visio workflow , select ‘Export’ from the ‘Process’ ribbon and select a save location.

Now fire up SharePoint designer and connect to a site. Choose ‘Workflows’ from the ‘Site Objects’ list.

Select ‘Import from Visio’ and locate the interchange (*.vwi) you exported above.

Now choose whether to assign to a list or a content type. Depending on your plan this is an important decision but for the purposes of this demo just choose a content type under the ‘Reusable Workflow’ dropdown.

So as you can see the logic from our Visio model has been imported into a If/Else start into SharePoint designers. From here the developers can link up the steps to the data sources / lists as required and you have a working workflow! Easy!

This is just an overview and I haven’t really got into the guts of the possibilities yet, but should serve as a primer to getting in and having a stab yourself.

Personally I see value in this more in improving and re-designing workflows than perhaps designing from scratch. A developer can build a workflow from requirements as they see fit and make the required design decisions based on their experience and understanding of the technical requirements. A business user may inadvertently make bad design decisions that impact the performance or the usability of a workflow.

The beauty of this model (I think at least!) is the ability to import an existing workflow, pull it into a nice, visual Visio format and let business users muck around with that. The logic and conditions will remain in the XML and when it is exported back to SharePoint designer, the detail will remain along with the required changes to the flow.

I’ll have more comments / thoughts in this area as I progress through, but if nothing else the above should serve as a base for those looking at SharePoint workflows in Visio.

Watchout for my next post on custom workflow actions and how they look when pulled back into Visio!