Monday, June 27, 2011

Sequential vs State machine workflows in SharePoint 2010

In this post we will discuss about Sequential vs State machine workflows in SharePoint 2010. Also you can check out:

- SharePoint 2013 default permission levels

- Add webpart zone outside PlaceHolderMain in SharePoint 2010

- How to create workflow using Visio and SharePoint designer in SharePoint 2010?

A workflow executes from one step to another in two ways. There are two types of workflows in SharePoint 2010.

a. Sequential: The steps within the workflow execute sequentially, one after another.
b. State Machine: Its executes in no particluar order.

A sequential workflow always progresses forward and never goes back to a previous step. On the other hand, A state machine workflow moves from one state to another, until the logic concludes that the workflow has completed.

There are some businees process that requires a state machine workflow like for example: a bug tracking system where When the workflow first starts, the bug may be placed in a Pending state, where it waits for a developer to be assigned and start working on thebug. When the developer starts working on the bug and fixes it, the bug is put into a Fixed state. When the bug is fixed, a tester confirms the resolution of the bug. If it is not fixed, he places the bug back in a Pending state.

So you should decide the type before developing the workflow. Because it will be very diffcult to change once you have started that workflow.

Visual studio provides both Sequential workflow and State Machine workflow.

Sequential workflow should used when there is only one way to complete a task and the workflow controls the process. But state machine wrkflow can stay in a same step for a longer period of time, must not be in an end state. State machine does not have any specified path, they are event driven.
You can also check Create a sequential workflow using Visual studio 2010 in SharePoint 2010.