Introduction to Workflows

Microsoft Windows SharePoint Services provides a robust, customizable work environment for users to create, collaborate, and store valuable business information. Now, with Microsoft Windows SharePoint Services 3.0 and Microsoft Office SharePoint Server 2007, you can attach custom business processes to these documents or list items.

You can represent these custom business processes by using workflows. A workflow is a natural way to organize and run a set of work units, or activities, to form an executable representation of a work process. This process can control almost any aspect of an item in Windows SharePoint Services, including the life cycle of that item. The workflow is flexible enough to model both the system functions and the human actions necessary for the workflow to complete.

You can create workflows that are as simple or complex as your business processes require. You can create workflows that the user initiates, or workflows that Windows SharePoint Services automatically initiates based on some event, such as when an item is created or changed.

Suppose you need to create a simple workflow that routes a document to a series of users for approval or comments. This workflow would include actions that the system needs to perform, as well as provide interfaces for the users to interact with the workflow in prescribed ways. For example, Windows SharePoint Services would send an e-mail message to the selected users when the document was ready for review. Those users would then need to be able to notify Windows SharePoint Services when they had completed their reviews and, optionally, enter any comments. The workflow framework included in Windows SharePoint Services 3.0, and extended in SharePoint Server 2007, enables you to model such complex work processes and present them to end users in an easily understood, unobtrusive manner that guides them through each step of the process.

Windows Workflow Foundation supports two fundamental workflow styles:

  • Sequential workflows 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.

  • State machine workflows 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.

You can create workflows of either type for Windows SharePoint Services and SharePoint Server.

Sequential Workflows

Sequential workflows can best be represented graphically as a flowchart of actions, with a beginning, an end, and a sequential flow direction from start to finish. Sequential workflows can incorporate flow structures such as repetition, looping, and parallel branches, but ultimately progress from the initial action to the final action.

For example, suppose you were to chart the simple workflow that routes a document in Windows SharePoint Services for approval. When the workflow starts, the system notifies the specified reviewer, by e-mail message, that he or she has a document to review. The reviewer then reviews the document and notifies the system that the task is completed and whether the reviewer approves or rejects the document. Based on the reviewer response, the workflow executes one of two parallel branches. If the reviewer approved the document, the system moves the approved document to a specific SharePoint document library and then sends an e-mail message to the entire team notifying them of the approved document. If the reviewer rejects the document, the system notifies the document author. In either case, the workflow then reaches its end and terminates. Figure 2 shows this workflow.

Figure 2. Conceptual diagram of a sequential workflow

Diagram of a sequential workflow

State Machine Workflows

Unlike sequential workflows, state machine workflows do not have a prescribed execution flow, and need not have an end. Instead, state machine workflows define any number of states which an item may inhabit, and the events that transition the item from one state to another.

Figure 3 represents a simple document publishing process, modeled as a state machine workflow. The workflow is initiated when a document is created, and ends when the document state is set as completed. In between, however, the document does not travel in a predetermined path, but instead transitions from state to state as events occur.

The state machine workflow is composed of state activities. Each state activity represents a state for the item. Each state activity can contain optional state initialization, state finalization, and one or more event handlers. Each event handler activity can handle one event. In response to the event handled, some processing can be done, and a transition can be made to another state.

Figure 3. Conceptual diagram of a state machine workflow

Diagram of a state machine workflow

One characteristic of both sequential and state machine workflows is that each type of workflow can be broken into a collection of discrete actions—those performed by the system, and those taken by users. You can consider these actions to be the building blocks of workflows. In WF workflows, these actions are referred to as activities.

if it is helpful, plese dont forget to leave a comment.