Workflows in Sharepoint 2010 Tutorial -Step1/20: What’s new


 The French version of this article has been published in the paper version of ITpro Magazine ( 


The author


Serge Luca (Sharepoint MVP) is Sharepoint Practice manager and Sharepoint 2010 instructor

at Devoteam Belgium; he is the author of 6 courses on Sharepoint 2010

(You can follow his “Workflow for Sharepoint 2007 tutorial” in 20 steps here)



Based natively on the Workflow Foundation engine, Sharepoint 2007 was the first version of SharePoint that made usage of workflows quite popular among Microsoft end users and .Net developers.

With SharePoint 2010, Microsoft has privileged robustness by choosing to use the .Net framework 3.5 sp1 (and thus Workflow Foundation 3.5), even if a new version of Workflow Foundation 4.0 (with an improved architecture and designer) is provided with .Net 4.

Despite this, SharePoint 2010 provides a set of welcome improvements. These include workflows that can be associated to web sites (and not just to lists); new options in “out of the box” workflows; the possibility to create workflows with Visio 2010, , as well as a new version of SharePoint Designer 2010 that can create real professional workflows which can then be used out of the box. Furthermore, it is now possible to generate workflow forms in Visual Studio 2010 to allow for a better and more flexible communication channel between the workflow and the outside world.

Site workflows


Previous versions of SharePoint did not allow for the association of a workflow to a specific list or indirectly to one or several lists via a content type. With SharePoint 2010 we can now associate one or several workflows to a SharePoint web site, which is pretty handy if the workflow needs to monitor actions happening in several places across the site.


What’s new in the “Out Of the Box” new features


Compared to SharePoint 2007, a number of important improvements have been added. For instance in the new version of the Approval workflow or of the Collect feedback workflow, it is possible to assign tasks by stages, or even to assign tasks to all members of a SharePoint group. As can be seen in the example below, illustrated in figure 1, two tasks can be assigned to users Amy Alberts and Brian Cox in serial; two other approval tasks are assigned in parallel to Alan Brewer and Alan Steiner ; and in the next step , all members of the “Devoteam Managers” group will be assigned a task .



Figure 1.Assigning tasks by stages and to all members of a group


Authoring workflows with Visio 2010


Visio 2010 has now a set of workflow shapes and can easily generate workflows .

An information worker can therefore author a workflow with Visio 2010 before giving it to a developer who will customize it; this can be done in both 2 directions: from SharePoint Designer 2010 to Visio 2010 and from Visio 2010 to SharePoint Designer 2010 (don’t forget that SharePoint Designer is free!).

This is illustrated in figure 2, where we see how an expense report approval process can quickly be designed in Visio 2010.



Figure 2. Creation of a SharePoint workflow with Visio 2010.

Visio 2010 goes beyond the workflow design: it also generates real workflow code (xoml) that can be reused and customized in a tool like SharePoint Designer 2010. In fact,  Visio 2010 can export the design into a file with a .vwi format (Visio Workflow Interchange) which is actually a zip file containing files  recognized by Workflow Foundation (.xoml and .rules files), but also a .vdx file for the pure Visio part (shape layouts).


Figure 3.Workflow files generated by Visio 2010

Creating a workflow with Sharepoint Designer 2010: what’s new


The 2010 version of Microsoft SharePoint Designer has now become an essential tool for a wide range of users like business analysts, designers and SharePoint developers. We strongly suggest investing time in becoming familiarized with it.


Let’s take a look at the new and improved workflow features of SharePoint Designer 2010.


1.       Importing a Visio generated workflow is straightforward and allows for customization by a designer or a developer




Figure 4.Importing a Visio 2010 generated workflow


The workflow designer illustrated in the next picture is also more intuitive than in the previous version. The annotations provided in Visio 2010 (like “Expense Report too expensive” and “Approve it”) can be retrieved in SharePoint Designer 2010 as illustrated in the next figure :



Figure 5.SharePoint Designer Edition of a Visio 2010 workflow.


2.       Reusing and customizing “out of the box” workflows

Out of the box workflows, like Collect Feedback and Approval, can be reused in customized workflows : it is a functionality we made use of in Visio 2010 (see figure 2) under the label “Assign item for approval”. Given that most custom collaborative workflows will use some kind of approval functionality, which is sometimes very complicated to program even for skilled Workflow Foundation .Net developers, this is a major improvement.


3.       The Office task brings a touch of flexibility in the behavior of the out of the box workflow tasks; it allows us to assign specific behavior to individual tasks, or to the whole approval session. For instance, we can implement the following requirements:

a.       If 50% of users approved, the system approves the item

b.      If the user is not available, assign the task to his manager

c.       As soon as an approval starts or completes, start a specific action (like sending an e-mail for instance)

d.      As soon as when a task is assigned to a user or is complete, start a specific action.


4.       Content types & site workflows


Probably the weakest feature of SharePoint designer 2007 workflows is that they had to be associated with specific lists and couldn’t be reused. This is a thing of the past: workflows generated with SharePoint Designer 2010 can now be associated with Content Types (which is generally considered as good practice) , or can be associated with a site.

As illustrated in figure 6, it is possible to create 3 types of workflows in SharePoint Designer 2010:


·         Workflows associated to a specific list

·         Workflows associated to a content type

·         Workflows associated to a site




Figure 6.SharePoint Designer can create 3 types of workflows.


5.       Security : Impersonation Step

Other improvements have been made to security. Previously, declarative workflows generated by SharePoint Designer 2007 were based on the identity of the user who initiated the workflow, which could be a problem if we wanted to access some unauthorized resources; on the other hand, workflows created with Visual Studio 2010 run in full trust mode (with the application pool user identity).

With SharePoint Designer 2010 we now have a kind of hybrid mode: we can run part of the workflow with the identity of the user who published the workflow (typically the Designer) by using the Impersonation step action as illustrated in figure 7.




Figure 7.Impersonation Step


6.       Infopath workflow forms


Workflows forms for SharePoint Designer 2010 workflows are now Infopath forms by default (they were aspx forms in the previous version); they can therefore be visualized in the Office2007 or 2010 rich client and can easily be customized with the Infopath 2010 Designer.


7.       Workflow visualisation


Thanks to the new Visio services built in SharePoint 2010, we can now visualize the state of our workflows Figure 8 illustrates an approval process where Brian Cox has completed his task and the system is waiting for Amy Alberts to take action before assigning a task to Alan Steiner.



Figure 8.Visualisation of a workflow


8.       Sandbox

Workflows authored with SharePoint Designer 2010 can run in a protected environment called the sandbox where they cannot put the farm in danger; workflows generated with Visual Studio must run in the farm mode, but not in a sandbox environment.


Missing features in Sharepoint Designer 2010


Just as it was the case in Sharepoint Designer 2007, it is not possible to author state machine workflows as it is done in Visual Studio; even if most workflows are sequential workflows, there are some situations where we need to be able to move back to previous steps in the workflow. In that case, forget Sharepoint Designer 2010 and move to Visual Studio 2010!


Another missing feature is that lack of the looping mechanism in Sharepoint Designer workflows: for instance, we cannot loop through several list items without having to rely on (.Net) custom activities created with Visual Studio.


Creating Sharepoint workflows with Visual Studio 2010: what’s new


1.       Creating workflows with Visual Studio 2010 is far easier than before thanks to the new Feature Designer (for managing SharePoint features), the new Package Designer (for managing SharePoint solutions packages) and the automatic debugging experience: by clicking F5 the debugger is automatically attached to the corresponding worker process.


2.       Like before, we have 2 workflow projects templates: Sequential Workflow or State Machine Workflow (question from Ronnie, if this is like before, why is it mentioned here?)


Figure 9.Templates for creating workflows in Visual Studio 2010.


3.       No sandbox

Unlike declarative workflows authored with Sharepoint Designer, workflows created with Visual studio cannot run in a sandbox but only in full trusted “Farm Mode”; this is a serious limitation to take into account if we want to move our customizations to Sharepoint Online in the future.


4.       Still the old Designer

Since workflow Foundation 3.5 is the workflow engine (version 4.0 with the new Designer is not supported), we still have to use the old designer which is quite slow when we need to display many activities.


5.       Importing from SharePoint Designer : irreversible

It is now possible to easily import SharePoint designer 2010 generated workflow into Visual Studio 2010; however, the process is irreversible, contrary to going from Visio 2010 to Sharepoint 2010.


6.       List or site workflows

We can create workflows linked to a list or to a site.


7.       Workflow events

We can now handle events generated when a list workflow is starting, is started, is postponed, or is completed; this is also true for declarative workflows


Figure 10.Creating an event handler to listen to Workflow events


8.       Workflow association and initiation forms


Creating workflow association forms and initiation forms is now very easy thanks to two new templates that generate aspx pages, as well as code that provides an exchange mechanism between the forms and the workflow.




Figure 11.Creating association and initiation forms in Visual Studio 2010


The developer only needs to add specific controls into the aspx forms and must implement 2 methods: GetAssociationData and GetInitiationData().

Unfortunately there is no template provided to generate workflow tasks forms and workflow modification forms.


9.       Communication with the outside world


One of the biggest improvement in SharePoint 2010 workflows is the possibility to create Pluggable Workflow Services which is an efficient way for workflows to communicate asynchronously with the outside world: for instance a workflow might needs to invoke an external line of business application (“lob”))  like SAP; the answer coming from the lob might take 1 second, but also one hour, one day or much more.


What was the problem in Sharepoint 2007?


A typical scenario in Sharepoint workflows is to communicate with end users by creating tasks and by listening to any task action performed by the users. In this specific case, the tasks are created by using the CreateTask activity that calls the Sharepoint api; we can make the workflow listen to the tasks changes by using the OnTaskChanged activity, which like all activities with a name starting with “On”, are event based activities. When a workflow runs an event based activity he becomes idle.

An important feature of idle workflows is to be automatically suspended , removed from the host process (“dehydrated”) and serialized in a media (like the Sharepoint content database) and to be “rehydrated” when the event comes up.

The benefit of using event based activities is that since workflows lie dormant in the SharePoint content database when they wait for an event, we can therefore run thousands of workflows in parallel and achieve great scalability.



Figure 12.Event based workflow activities (in green)


In SharePoint 2007 however, we can only use a limited number of event based activities provided by Microsoft: that makes asynchronously calling LOB (Line of Business Applications like SAP) quite shaky by having to create tasks and by asking the LOB to communicate with the workflow by changing the tasks.


In Sharepoint 2010


Today it is no longer necessary to follow this complex pattern ; instead it is now  possible to  listen to any custom event and to use the HandleExternalEvent activity provided with Workflow Foundation 3.0 (see figure 12) and well known by .Net developers!



Figure 13.calling an external system


However, to achieve it it is still necessary to create a pluggable service by creating a custom class derived from the new SPWorkflowExternalDataExchangeService ; this custom class must be declared in the web.config.




Even though the workflow aspect of SharePoint 2010 is not revolutionary, it is now much, much easier to create workflows.

Sharepoint Designer and Visio 2010 provide major added value: workflows created with Sharepoint Designer can be reused, it is possible to customize and reuse out of the box workflows, and there is a better and scalable communication channel between Sharepoint and the outside world.


8 responses to “Workflows in Sharepoint 2010 Tutorial -Step1/20: What’s new

  1. Hello, thanks for your useful information. I have a problem to create a workflow with vs 2010. I could not find workflow association forms and initiation forms. Could you tell how can I add this two forms into vs 2010?

    Thank you very much in advance!

  2. Hi There, Great Article, everythign highlighted and explained very nicely. i have one question.. is there no way to create a workflwo for content type directly from VS 2010, must i first create in SPD 2010 and then import it into VS 2010 and then move forward?

    If there is a possibility please let me knwo.


  3. Hi,

    I have a small issue to develop 2 step approval workflow in Visual studio. Below is my problem.

    Can you please guide me to develop a visual studio workflow in SharePoint 2010 foundation? I Can’t use in built approval workflow in Sharepoint designer because, Sharepoint foundation is not supports this workfow. So I have to go with VS only.

    My requirement is like this. There are 3 roles – Entry Clerk, Supervisor, Manager.
    Same way 3 status – Pending Verification, Require Clarification, Approved.

    Entry officer will enter the list item and submit it. A task will generate for supervisor with status pending verification. If supervisor will rejects the item then status of the item will be require clarification else status will be approved. In case of rejection, task will be create for entry officer. Entry officer can resubmit the task wit modified values. Again the same process will go on still item approve. So any one guide me to develop this kind of workflow in VS 2010.


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