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.

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.

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!

Adding External Data to Visio 2010 Models – An example using State Chart’s in Visio 2010

Having recently started a new position and having to dust off the UML skill set, I’ve found a useful feature of Visio that I wanted to share. No doubt has been covered in detail before but perhaps not for this specific example.

I’ve been working on state charts for a system re-development and had a list of existing states from the old application that i wanted to cross reference against the new states i had modeled.

Rather than eyeballing everything manually I decided to use the .xls with my list of status as a data source in Visio and see what was missing from my updated model.

First select the ‘Link Data to Shapes’ option from the Visio ribbon.

Then as your data source, select an ‘Excel Worksheet’ – remember you could use any of the listed data sources to achieve the same objective if that’s easier. It might be a DB extract from a legacy system or a screen dump converted into a table or .xls – the world’s your oyster!

Personally I like the new SharePoint foundation list option, that is a powerful and useful way of incorporating business data into your models – possibilities are interesting there!

Then choose the .xls (or .xlsx!) you wish to use as your data source.

Now we have to select the range in the excel worksheet to use for our data. If you know the range go ahead and type it in, otherwise select ‘Select range’ and manually select the area you wish to use.

Once its in we need to select the column(s) we are concerned with. it may be useful to include an identifier column in your data in case you have integrity issues when changing things later on.

The next screen allows you to assign an identifier column (explained above). This is optional and useful if you plan on updating naming conventions and have a larger set of data.

Select ‘Finish’ to close the wizard.

If the import was successful you will see the ‘External data’ window appear with the columns you selected.

From here you can manually ‘drag and drop’ data onto shapes on your diagram to link, but I suggest using the handy auto-link feature handily provided by Visio 2010.

Assuming you named your shapes in a similar convention to the imported data, in my case it was naming system states and importing old state data, you will get a quick easy link between your source data and your shape elements. If this means tidying up your model and/or source data quickly first then it will probably save you time in the long run.

Like I said at the top of the post, not ground breaking stuff here, but still useful info for those working in this area.