Sharepoint Workflow (1)

[Notes from Sharepoint 2010 Development with VS 2010 – Addison Wesley]

Page 525 – VS 2010 supports two kinds of work flows – Sequential workflows
and State machine workflow.

(1) Sequental workflow – represented as a flow chart. Have a definite beginning and end. All execution paths can be easily identified from the workflow model.

(2) State machine workflow – introduces the concepts of states, events and transitions. If you have a more complex business model. Every state machine workflow has a defined initial state and end state. The execution path taken between the start and end state depends on the transitions between states and events that trigger those transitions. Ther eis no pre-scribed path, as is the case in sequential workflow. Very hard to identify all the paths.

Visual Studio 2010 ships with about 30 general workflow activities and an additional 26 SharePoint-related activities. These can be found in the Toolbox.

3 Activities categories:

(1) Control flow activities – Control flow activities are used as decision points in workflows and control the execution path within a workflow. They have a condition attached to them, such as IF, Else, While; 2 types: declarative (using XML, saved in *.rules) and code condition (.NET code) .

(2) Container activities – Container Activities serve as a grouping mechanism and can contain multiple activities; such as Sequence Activity.

(3) Standard activities – Standard activities are used to execute some task.

Workflow not supported by Sharepoint: Compensate, Compensatabletransaction and CompensatableSequence.


Create a new sequential work flow in VS 2010, farm solution, list workflow.

Then workflow designer:

Note: You can’t convert VS 2008 workflow into VS 2010. Have to do it manually.

Drag a CreateTask to the designer

The red exclamation mark means there are required properties that have not been set.

Click createTask1, set the CorrelationToken to any name, and select an OwnerActivityName

You must use the same correlation token if you want multiple activities to reference the same task (such as in a CreateTask activity at the beginning of a workflow and then later in a CompleteTask or other task-related activity that is referring to the task that was created in the workflow).

Correlation token is a unique string identifier within your workflow

Update TaskID and TaskProperty field:

After that:

Double click the createTask1 to open the source code view.

Enter these code:

(continued in (2))

Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: