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!