Can anyone provide me any small state machine workflow example with every step, procedure to create and code behind. Is there any portal where I can check numerous state machine workflow examples or any site where I can get my project build (any paid or unpaid)
State machine is a model of behavior composed of a finite number of states, transitions between those states, and actions.
Microsoft Visual Studio 2010 provides a State Machine Workflow template that enables you to build workflow solutions for Microsoft SharePoint 2010 by using a graphical design surface. Unlike sequential workflows, which transition from activity to activity, state machine workflows transition from state to state.
Have a look at the below links,
If you are new to SP workflows, don't start with state machine. Try sequential first. There is almost no difference except state machine is composed of multiple sequentials.
Also be aware of setting tokens properly, Task ids etc. It is very hard to debug if you accidentaly put wrong correlation token, task or item id.
I would recommend you the link mentioned in another answer: http://msdn.microsoft.com/en-us/vstudio/Ff623023 there is nice video tutorial and code sample.
If you are looking for a book, I would recommend Sharepoint 2010 Workflows in Action. Explained step by step, many screenshots.
I just wanted to add that it is possible to build State Machine workflows via SharePoint Designer as well. You simply add a couple of columns to the list in question -- one to track current state, and one as a boolean to indicate if a state change took place. More info on that is at How To Create a Customized (yet still semi-basic) State Machine Workflow with Sharepoint Designer 2k10
If you also implement some of the error handling advice in the following link, you can have a pretty solid solution without any VS code (Handling workflow errors)
In my opinion, Visual Studio state machine workflows are one of the hardest things to implement in SharePoint 2010. Typically, when I implement a workflow, it evolves as it is being used by the business users. Unfortunately, the VS state machine workflow is extremely difficult to update elegantly once it is deployed. Almost any data related change will break serialization. This means that it is extremely difficult to alter any "in-process" state machine workflows (More info on serialization issues here: http://habaneroconsulting.com/Insights/Approach-to-upgrading-custom-SharePoint-workflows.aspx). I have had cases where there are many instances of a workflow running, and the stakeholders decide that something HAS to be modified, and it MUST occur on active workflows. If you ever find yourself in this situation, it is a difficult one to work through.