Wednesday, April 28, 2004 9:45 PM Jan Tielens

Simple Workflows and Approval Routes in SharePoint

UPDATE: Visit the GotDotNet Workspace to download the engine!

Quite a lot of people are asking if Windows SharePoint Services offers workflows and/or approval routes. The answer is: no, not out-of-the-box. You can fairly easy extend SharePoint and attach an event handler to a document library. This event handler is nothing more than a .NET class that implements the IListEventSink interface and contains some logic corresponding to the desired actions. For more information around this topic you can read Patrick Tisseghem’s excellent article, or  this article from the MSDN Library. The downside of this approach is that for each specific workflow or approval route you need to code an event handler.Unless you create something more generic and configurable: let me introduce you to my new “pet project”!

I’ve created a generic event handler for SharePoint document libraries, that easily can be configured to create any workflow or approval route. Consider following approval route scenario to get an idea what you can accomplish with this event handler:
There is a SharePoint site with three document libraries: Work In Progress, In Review and Reviewed. Contributors can submit documents in the Work In Progress library, every contributor of the site has access to that library. Documents in this library have a custom choice field, named Status with following possible values: Work in progress, Ready to publish and Declined. Once a document in the library gets the Ready to publish status (assigned by the contributor), the document will move to the In Review document library. Only people that are Reviewers can access this library. The library also has a custom choice field, named Approval, which can have these values: Approve and Decline. Once a Reviewer has reviewed the document, he or she can set the Approval property to Approve or Declined. When the document is declined, it will be moved back to the Work In Progress document library. When to document is approved it will be moved to the Reviewed document library, which can be accessed by every member of that site.

I guess this scenario sounds pretty familiar, nothing fancy, just the basic needs of a lot of people. Now take a look at following XML configuration file:

It contains all the settings to use the scenario described above. You can see two WorkflowStage elements: there correspond with a document library which are a stage in the workflow process. In each stage you can assign triggers to properties. For example the trigger “Ready to publish” is assigned to the Status property, so when the Status field of a document in the document library changes to “Ready to publish”, the trigger will fire all the Actions it contains. Each action has a Type and up to three parameters. A property can have more than one trigger, for example the Approval property: based on the value of the Approval field the document is moved to the corresponding document library. At this point I’ve implemented following types:

  • MOVE: copies the document from the current library to a specific document library (value of Parameter1).
  • DELETESOURCE: removes the document from the current document library, for example after it’s copied to another library.
  • SETFIELDVALUE: sets a specific field to a value, for example to fill out a Reviewer field.
  • COPYFIELDVALUE: copies the value of a field from the originating document to the new document, for example after it’s copied.

But I’ve already several other possibilities in mind: send email, set field value to calculated value, … I think the event handler can cover quite a lot of basic workflow and approval route scenarios. If you have any comments to add or specific request, please let them know so I can implement them! When this project is ready to be published, I’ll release it so if you’re interested keep an eye on my blog. The goal of this project is to provide an easy and quick solution for basic workflow and approval route scenarios. It won’t replace commercial products that provide solutions for complex workflows. Let the feedback come!

UPDATE: Visit the GotDotNet Workspace to download the engine!

Filed under:

Comments

# SharePoint Workflow, WebParts

Wednesday, April 28, 2004 12:25 PM by TrackBack

SharePoint has simple 'out of the box' workflow capabilities, but there suddenly seems to be an abundance ...

# re: Simple Workflows and Approval Routes in SharePoint

Thursday, April 29, 2004 5:26 AM by Duncan Millard

Jan, you might want to look at <a href="http://www.k2workflow.com">K2.NET</a> which is a workflow package offering complete integration with SPS (and BTS and a few other packages). Obviously your pet project will be far cheaper but hey we like using workflow tools right? :-)

# re: Simple Workflows and Approval Routes in SharePoint

Thursday, April 29, 2004 5:28 AM by Duncan Millard

Well that hyperlink came out well. Try http://www.k2workflow.com :-)

# re: Simple Workflows and Approval Routes in SharePoint

Thursday, April 29, 2004 5:30 AM by Jan

Duncan, I'm familiar with K2.NET. As you already mentioned my Workflow engine will be far more simple (and for free). It's aimed at simple workflows where K2.NET is to expensive.

# re: Simple Workflows and Approval Routes in SharePoint

Thursday, April 29, 2004 11:33 AM by Eric

Sounds like a great project. Keep us informed how its going. I've been looking everywhere for a cheap\simple workflow routing system, haven't found one yet.

# re: Simple Workflows and Approval Routes in SharePoint

Thursday, April 29, 2004 11:37 AM by Eric

You might want to check out Scot P Hillier's SharePoint book, it has a simple work flow engine in it.

# My SharePoint Workflow Pet Project Update

Thursday, April 29, 2004 11:26 PM by TrackBack

# My SharePoint Workflow Pet Project Update

Thursday, April 29, 2004 11:37 PM by TrackBack

# re: Simple Workflows and Approval Routes in SharePoint

Saturday, May 01, 2004 4:54 AM by EROL

Thanks, EROL

# re: Simple Workflows and Approval Routes in SharePoint

Thursday, May 06, 2004 4:29 AM by Stephane Baudet

And when do you think to plan your first release ?

# re: Simple Workflows and Approval Routes in SharePoint

Thursday, May 06, 2004 4:50 AM by Jan

Beta is now available:
http://weblogs.asp.net/jan/archive/2004/05/05/126614.aspx#127000

I'm planning to add some more Action types, so I expect a 1.0 release in the next few weeks.

# re: Simple Workflows and Approval Routes in SharePoint

Wednesday, June 02, 2004 1:47 PM by Raul Tejada

Sounds what I have been looking for, please keep me posted when you have implement it.

Regards

Raul Tejada

rtejada@pancanal.com

# re: Simple Workflows and Approval Routes in SharePoint

Wednesday, October 17, 2007 3:20 PM by Simon Thompson

Hello all, thank you for looking at this post

Scenario:

I need to create an 'Absence Request' system which needs to do all of the following:

Allow all users to see when anyone is on holiday (I understand how to create a calendar view of data in a list)

When a request is submitted to the list ONLY their immediate manager and the submitter should be able to see the request.

An approval workflow should then be started to submit to their manager for approval

If approved then the item should be visible to all

The Problem:

Imagine this structure in the IT department:

Jay and John report into steve (Steve can approve their Holidays), Sally and Jane report into Andy (Andy can approve their Holidays), Andy and Steve report into Ian (Who can approve their holidays)

I have created a form library in sharepoint and published an infopath form to it for users to fill in. This automatically is populated with data from a database (using a web service) with such things as their name and their managers name and email address... so far so good.

They are then able to submit this form to the library and relevant metadata in the list is created, namely their ManagersEmail address.I am able to get an email fired off to the correct manager for approval.

The problem is is because Andy, Steve and Ian have 'Approver' rights in the form library, they can all approve anyones submission, even their own!

It is impractical to create a library for each approval level (as this is just one dept and there are 30 ish).

My thoughts

I thought about trying to filter the list to only show items where the ManagerEmail field is equal to the users who is looking at the list. I tried the web parts but none seemed to allow me to specify which field i wanted to compare against.

Tried to make it aso only the Manager could open entries where he was in the ManagerEmail column

Thought about audiences but got nowhere

The Big Question(s)

Is it possible to have a different level of approval for each item in a list? (set programatically)

Could i filter the list so only items with the current users email in the ManagersEmail field show?

Can i only allow the user in the ManagerEmail field to approve the request

Either i am missing something here or lots of people must be having this problem.

Thanks in advance.

# re: Simple Workflows and Approval Routes in SharePoint

Friday, November 16, 2007 3:38 AM by ramya

Can u please suggest me where to mention the above xml codings..Is it in web.config file or should i develop a separate xml.If so,how will i incorporate event handler to the share point document library....Please i am in urgently need of it