Versioning SharePoint Workflow

Lets say you developed and deployed a complex state workflow using Visual Studio with WSPBuilder add on. Things are going smooth and the business came up with new set of requirements/changes to the workflow. What would be your approach?

You cannot just modify/update the Visual Studio project according to the new requirements and deploy it. This might entirely mess up your existing workflow items, especially the workflow instances which are in waiting mode i.e waiting for an external event are serialized and persisted in the SharePoint content database. When you deploy your modified workflow and when the workflow engine tries to deserialize the existing instance from DB it might fail as it cannot match with the updated workflow dll and thus end up halting the workflow process.

There is no out of the box solution to maintain versions of the same workflow. However there are workarounds to it. Please read this blog entry which is widely accepted and implemented.

The basic idea is to create a complete new workflow project with different name and solution id. Then deploy it and attach to the same doc. library. Then using the doc. library workflow settings select “no instances” for the old workflow and “allow” for the new workflow. This will attach the new workflow for any new items and the existings items will still continue with the old workflow.

**If you are using InfoPath form to build the workflow task form then make sure that you have a new version of the infopath form with a different name.

Follow the below steps to easily make a new version of the existing workflow project:

  1. Create a new project based on the WSPBuilder with Workflow project template and name it as same as your old workflow name appended with the version number. Ex. MyCompany.StateWorkflow.Ver2
  2. Now right click the project and new state workflow project item from the WSPbuilder items. Provide the same name as exists in the old workflow project so that it creates the .CS and .Designer files with the same name.
  3. Copy the .CS and .Designer files from your old workflow project to the new project replacing the newly created ones.
  4. Compile and make sure the project is having no build errors.  Its almost done.
  5. Next steps would be to modify the workflow/elements xml files to bring it up to speed with the old workflow xml file entries. Also, make a new copy of the InfoPath task form name it appending the version number and copy to the new project structure.

The above may not apply for everyone and may not apply for SharePoint 2010 workflow. I documented the above steps so that I can come back and follow them whenever required.

How to show the forms library item data to which workflow is attached in the infopath based task form

I have an infopath forms library list in my SharePoint site. (Forms library is basically a document library whose content type is of InfoPath forms type or xml document type) This list holds the request forms which end users submit using the browser based infopath form.

I have my custom workflow developed in VS 2005 attached to the abvoe forms/document library. My custom workflow has couple of task forms developed using InfoPath again, which the reviewer and approver uses to approve/re-assign/reject the request form.

My question is how to show the whole request forms data preferably with the same design and structure within the task forms. So here I am trying to show the request form which is a infopath form in a task form which is again another infopath form. May be atleast a readonly view of the request form will also suffice.

This helps the reviewer and the approver to see the client request within the task form and take the decision to approver or reject or re-assign.

I hope I am clear with my question. Please let me know your comments and a direction to go around to solve this. Thanks a lot guys 🙂

SharePoint & Windows Workflow Foundation – (Sequential, State Machine Workflows, InfoPath Forms)

Below are the plethora of links to learn Workflows and its integration with SharePoint using InfoPath forms and or ASPX pages. You will find here some nice resources for State Machine Workflows in particular.

If you are new to workflow development then as a 1st step towards it, learn sequential workflows. Either read my former blog post or go for this step by step sequential workflow example.

http://channel9.msdn.com/Showpost.aspx?postid=122931 – this is a quick 9 min video: I recommend this to be your 1st step towards learning state machine workflows. For a detailed video of the same example check out the MS webcast by Pravin Indurkar. The Order Processing Application code is available for download in the below Microsoft Workflow Samples link.

http://msdn2.microsoft.com/en-us/library/ms741723%28VS.85%29.aspx – Windows Workflow Foundation Samples

http://blogs.msdn.com/sharepoint/archive/tags/Workflow/default.aspx – 7 part series

http://kcdholdings.com/blog/?p=68 – links/recommended books

http://jopx.blogspot.com/2008/02/sharepoint-workflow-link-wrap-up.html – More links …

http://www.mannsoftware.com/Blog/?cat=15 – Blog

http://www.devx.com/webdev/Article/34032/0/page/1

The below 4-part series is a good and The Best example or sample available related to Workflows and SharePoint:

https://blogs.pointbridge.com/Blogs/morse_matt/Pages/Post.aspx?_ID=9

https://blogs.pointbridge.com/Blogs/morse_matt/Pages/Post.aspx?_ID=11

https://blogs.pointbridge.com/Blogs/morse_matt/Pages/Post.aspx?_ID=15

https://blogs.pointbridge.com/Blogs/morse_matt/Pages/Post.aspx?_ID=16

https://blogs.pointbridge.com/Blogs/morse_matt/Pages/Post.aspx?_ID=20

Windows Workflow Foundation – Excellent Use Case: http://www.microsoft.com/belux/msdn/nl/community/columns/kurtclaeys/wf.mspx