Learn more about SQL Server tools

mssqltips logo
 

Tutorials          DBA          Dev          BI          Career          Categories          Webcasts          Whitepapers          Today's Tip          Join

Tutorials      DBA      Dev      BI      Categories      Webcasts

DBA    Dev    BI    Categories

Special Announcement: SQL Server Performance Tuning Tips and Tricks Webinar
 

How to implement reusable workflows on multiple lists in SharePoint 2010


By:   |   Read Comments   |   Related Tips: > Sharepoint

Problem

In SharePoint, a List is one of the most usual ways to store data. We can have multiple lists using the same kind of data (i.e. the Finance and Sales department lists could share the same kind of employee data -- name, address, experience in years and experience level). Now in such a scenario, what if one wants to implement a single centralized workflow which would apply the same automation process to both lists?

Solution

For such a scenario, SharePoint 2010 has introduced a new kind of workflow which is called a "Reusable Workflow". One use of this kind of workflow is to create it and attach it to different lists. This would be created on a content type. So it could be attached to only the lists which implement the same content type on which the reusable workflow is created.

Let us start by creating a content type. Create a content type similar to what is shown in image (below) and name it "EmployeeContentType". Also create two lists. One named "Sales" and the other named "Finance", both using the same content type.

site content type

Now open the web application in SharePoint Designer 2010 and click on workflows. On the top ribbon, click on reusable workflow.

reusable workflow

Provide a name to the workflow and select the content type on which the workflow should be created. In our case it is "EmployeeContentType".

create reusable workflow

Now we have added a simple workflow which will update the employee experience level field according to the years of experience of employee.

updating experience level

Save and Publish it. Now for attaching it to multiple lists, you need to check with which list the workflow could be attached? To do so, click "Associate to List" on the top of the ribbon of SharePoint Designer. At the back end, a web service will fetch the list depending upon the content type applied to the list. In our case there are two lists "Sales" and "Finance". Click on "Sales".

associate to list

A window will appear which would be similar to an out of the box workflow creation window. Here we need to take care of 4 things:

1) Select the same content type on which the workflow is created -- which in our case is "EmployeeContentType".

2) Select the name of the reusable workflow (which in our case is "EmployeeWF").

3) Provide a unique and meaningful name to the workflow for identification.

4) Configure the start options of the workflow as required.

Click for larger image

After performing the above steps, create the workflow. Now we have a sales list with some data.

emp name

Now to trigger the workflow, one can edit the items and save it -- accordingly the workflow will update the experience level field values.

emp experience

Perform the steps for associating the workflow to the finance list until updating the values just like we did in the sales list.

emp name

Now the finance list will share the same kind of workflow and values updated accordingly.

Next Steps
  • Use a reusable workflow, to create a similar workflow for multiple list.
  • Use it to reduce redundancy as well as to maintain a single, centralized workflow


Last Update:


next webcast button


next tip button



About the author
MSSQLTips author Rahul Mehta Rahul Mehta is a Project Architect/Lead working at Tata Consultancy Services focusing on ECM.

View all my tips





Post a comment or let the author know this tip helped.

All comments are reviewed, so stay on subject or we may delete your comment. Note: your email address is not published. Required fields are marked with an asterisk (*).

*Name    *Email    Email me updates 


Signup for our newsletter
 I agree by submitting my data to receive communications, account updates and/or special offers about SQL Server from MSSQLTips and/or its Sponsors. I have read the privacy statement and understand I may unsubscribe at any time.



    



Learn more about SQL Server tools