Creating Parallel Tasks from a SharePoint 2010 Workflow
3 minutes to read
Summary: Learn how to create parallel Microsoft SharePoint 2010 tasks in a Microsoft Visual Studio 2010 workflow project.
Applies to: SharePoint Foundation 2010 | SharePoint Server 2010 | Visual Studio | Visual Studio 2008 | Visual Studio 2010
Provided by: Scot Hillier, Microsoft SharePoint MVP
A task is a key component of any Microsoft SharePoint 2010 workflow. Your workflow might need to assign and track parallel tasks. You can create parallel SharePoint tasks from a Microsoft Visual Studio 2010 workflow project.
To create parallel tasks in a workflow, you must use a ParallelActivity activity in the workflow.
Creating the Workflow
When you create parallel tasks in a SharePoint workflow, begin by creating the tasks outside the ParallelActivity activity. Then, use a ParallelActivity activity to track when each parallel task is changed or completed. Figure 1 shows the complete workflow with two parallel tasks.
When you create parallel tasks in a SharePoint workflow, you must first use the CreateTask activity to create tasks. Then you can use the ParallelActivity activity to track when the tasks are changed or completed.
Following is a review of the activities:
The CreateTask activity creates a new task in a SharePoint list.
The OnTaskChanged activity checks whether the task is complete each time a user changes the task in some way.
The CompleteTask activity finishes the task and allows the workflow to continue.
The ParallelActivity activity causes the tasks to run in parallel so that they can be completed in any order.
Scot Hillier is an independent consultant and Microsoft SharePoint Most Valuable Professional (MVP) focused on creating solutions for Information Workers with SharePoint, Office, and related .NET Framework technologies. He is the author/coauthor of 15 books and DVDs on Microsoft technologies, including Inside Microsoft SharePoint 2010 and Professional Business Connectivity Services. Scot splits his time between consulting on SharePoint projects, speaking at SharePoint events like Tech-Ed, and delivering training for SharePoint developers. Scot is a former U.S. Navy submarine officer and graduate of the Virginia Military Institute. Scot can be reached at firstname.lastname@example.org.