Thursday 6 February 2014

Reusable and Globally Reusable Workflows in SharePoint 2010

Introduction

"SharePoint Designer Workflows" is nothing new, we've had that in 2007 as well. In SPD 2007, workflows were not reusable. Once you have defined a workflow, you cannot move that workflow to another list or reuse it somewhere else.
NOW in SharePoint 2010, this is possible! You can create reusable workflows and attach them to more than one list.
"Reusable workflows" is one of the coolest features in SharePoint 2010, however when I opened up SPD for the first time, I was a bit confused because I noticed two different terms "Reusable Workflows" and 'Globally Reusable Workflows".
ResuableAndGloballyReusable
When you create a Reusable workflow in SharePoint Designer 2010, it’s by default reusable within the site it has been created in, which means that it can be attached to any list within this site. But what if you want your workflow to be reusable in the whole site collection? Well, this is the definition of “Globally Reusable Workflows”. You can easily convert your workflows to be available anywhere in your site collection by opening your workflow and clicking on “Convert to Globally Reusable” from the ribbon as shown below.
convert_to_globally_Resuable_wf
Warning
Also it’s worth mentioning that only the workflows created at the root level of the site collection can be converted to be Globally Reusable but other ones created in sub sites cannot. Try to create a workflow in a sub site, open it and note that the Conversion button is dimmed.
convert_to_globally_Resuable_wf_dimmed
Another important question is what if I want to take my workflow and give it to somebody else in a different site collection? There’s another button in the ribbon called “Save as Template”, this takes the workflow, put it in a wsp file and save it to the ‘Site Assets” library. You can export this file and deploy it to other site collection and what’s really cool is that you can import this wsp into Visual Studio and extend it over there.
SaveAsTemplate
VS2010
Very cool stuff! Thanks Microsoft for this feature!

Importing SharePoint Designer Workflow Into Visual Studio 2010

VS 2010 can import a *.WSP file that has jst a workflow, or even the entire Sharepoint web site.
Before we import workflow *.wsp into VS 2010, we need to export it to a *.wsp file, either from Sharepoint 2010, or Sharepoint 2010 Designer:
Sharepoint 2010 Designer –

When done, a message says it’s in Site Assets

Go to Site Assets, click Export File to export it to a local *.wsp file.

Sharepoint 2010 Server –
Site Actions à Site Settings, under Stie Actions:

In VS 2001, create a new project.

No comments:

Post a Comment