Thursday 28 February 2013

Difference B/W Sequential Workflow and State Machine Workflow

Sequential Workflow:
- It looks very simple like flow chart.
- Steps within the workflow execute sequentially, one after another in the particular order.
- A sequential workflow always progresses forward, never going back to a previous step.
- Sequential workflows are definitely much easier to design and maintain.

State machine Workflow:
- A state machine workflow executes in no particular order and these are based on events like OnTaskCreated, OnTaskDeleted etc.
- A state machine workflow moves from one state to another until the logic concludes the workflow has completed.
- Compared to Sequential workflows State machine workflows are difficult to design and maintain.
- In order to move to another event, the workflow needs to meet another state.
- The workflow doesn’t really have to end. It can stay in the same state for weeks.
Visual studio provides both Sequential workflow and State Machine workflow. But in SharePoint designer you can only make sequential workflows.

There are some business 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 the bug. 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 difficult to change once you have started that workflow.

Sequential workflow should used when there is only one way to complete a task and the workflow controls the process. But state machine workflow 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.

No comments:

Post a Comment