SharePoint 2010 WorkFlow
In this article I will explain what are the enhancements in Workflow in SharePoint 2010 than in previous version of SharePoint. Workflows help to automate business process,The workflow feature in SharePoint Server 2010 enables solution architects ,administrators and designers to improve business processes Workflows in SharePoint are reusable too.
1. Introduction to workflow
There are two types of workflow (refer msdn):
A sequential workflow represents a workflow as a procession of steps that execute in order until the last activity completes. However, sequential workflows are not purely sequential in their execution. Because they can receive external events, and include parallel logic flows, the exact order of activity execution can vary somewhat.
State Machine Workflows
A state machine workflow represents a set of states, transitions, and actions. One state is denoted as the start state, and then, based on an event, a transition can be made to another state. The state machine can have a final state that determines the end of the workflow.
• SharePoint Designer now allows to creates reusable workflows
• We can build workflow using Visio, Export/Import Visio to SharePoint Designer
• We can create workflow in SharePoint designer, export/import them in Visual studio
• In Visual Studio , we can create workflow templates , creating the wsp files , we have new edition of SharePoint project item template in Visual Studio for association forms / initiation forms
2. What's new in SharePoint 2010 Workflow?
• In SharePoint 2007 , workflow based on Windows Workflow Foundation, so it provides a runtime for dealing with creating reactive applications, the applications start and then it has to pause because it is waiting on some external factor such as an user to click on the approve button or an external application to send back an message , so workflows are instances which have behavior and state , when the state changes the workflow instance has to be put in sleep and written to the database and later pulled back in and has to continue executing where left of , WWF provides a valuable amount of infrastructure for SharePoint workflow architecture
• In SP2010 we have end-users to run a workflow
• In SP2007 every workflow has to be associated with list items or documents, what if I need a workflow that will automate a closing of alone, so in SP2007 you have to create a arbitrary list , there will be one item for alone closing and workflow associated to it but now In SP2010 you can create site based workflow , so now a workflow can run on document set as well as in List
• We have viso support for workflow, export/import it to SharePoint designer ,
• In SP2007 workflows are not re-usable, but by using SP2010 designer we can create reusable workflows for other list/sites, instead creating same steps in new workflow
• SP2010 has workflow designer and task designer
• Workflow: conditions and actions , nested logic in workflow which was not there is SharePoint designer 2007
• You can create workflows based on the content type, Item
3. SharePoint 2010 Workflows on Visual Studio 2010
Here you can create workflows at site level similar to SP2010 designer which was not possible in SP 2007,Do workflow event using Visual Studio 2010.
The Base class for handling workflow event is SPWorkFlowEventReceiver
4. Pluggable EDE Services (VS 2010)
• There is also a great support inside the SharePoint, when we need to interact with external system.
• In SP 2007, because of low level nature of workflow running inside the SharePoint, you can't write piece code which executes outside of workflow environment, simply enter and call a method is not possible in SP 2007.
• Now we have a scenario where another system/application across the network knows that a workflow has been put to sleep and needs to be waken it back up, so that trick we use in 2007 is to leverage the fact that a sharpoint workflow could be put to sleep waiting on a list item to be changed and then there would be a call from across the network , I have a web service entry point the code there go and change the list item which makes the workflow to wake up and continue to executing
• But now with the pluggable services we have , we can simply use two different activities that come out of the box Workflow 'Call external system' and 'Wait for notification' so that I can make outbound calls ,and then the outbound call make the workflow to put in sleep and then as the calls come back goes to other activity like waiting for input , it automatically tells the SharePoint I need to wake up the workflow instance it is able to find the correlation information pull back workflow instance out of the database and resume its execution and so as far as able to integrate SharePoint with external systems , this is a really nice step forward
• Note : You cannot add workflow to sandbox solutions
• The user can start the workflow automatically , or when an item is added or an item is changed .
• When you create a workflow at site level they cannot be automatically start, they have to be kicked out manually.
• When workflow is created in VS 2010 it generates Elements.xml , Workflow.cs and also adds a new Feature because it needs a site collection feature to basically take the elements at xml file and add that in
• VS 2010 automatically builds the workflow project into solution package.