Tuesday, January 06, 2009

Infinite looping the MOSS OOTB approval workflow

A few days ago, I noticed something weird with the Microsoft Office SharePoint Server out of the box workflow, most specifically with the workflow option to start when an item is modified.

I was trying to set up the Approval Workflow on a SharePoint List with content approval activated. I first set up the workflow to ask for approval when a new item is submitted to the list. It worked fine but we also needed to ask for approval when an item was updated (e.g. the writer made a mistake and notice it after the approver did his job, thus he modify the item that as a result needs to be approved a second time).

I fired up the workflow configuration page and checked the infamous “Start Workflow when an item is modified” in the start options.

From a french MOSS install

And from then everything went wrong. Whenever an approvers did his job by approving an item, the workflow would be launched again and a new approval task would be added to the workflow task list.

I tried tweaking the workflow, modifying the tasks list used … but nothing would do the trick, the workflow was stuck in an infinite loop whenever the “Start on item edit” was activated.

And that’s when it hit me, changing the approval status of an item seemed to be considered as a modification of the item itself.
I am still surprised by what I can’t help but see as a major flaw of SharePoint. I definitely don’t think that the approval status of an item is part of the item itself, it is only a SharePoint information about OUR piece of information (the item).

I also was surprised by how few people seems to react to this fact based on a few google search I made. Yet it seems other people faced the same problem (http://social.msdn.microsoft.com/Forums/en-US/sharepointworkflow/thread/62f5921d-9d02-4924-a61f-97ad169d1043/ and http://unitedsupplyco.sharepointsite.net/publicfacing/bensblog/Lists/Posts/Post.aspx?ID=34 ).

If you have any information about this subject, I would enjoy to know it.


Lars Nielsen said...

Yes it's a big flaw in SharePoint I'm afraid. We got this problem quite soon after we began experimenting with SharePoint and the other day I was on a course where the instructor was demonstating OOB approval workflow and got the same issue. The workaround is to use different versioning - I think you use minor/major versioning instead of major only (or maybe the other way around, I forgot). To be honest the OOB Approval workflow leaves a lot to be desired - it generates about 3 mails for every document that needs approval - it's too many and it confuses people.

Leon Morris said...


I've taken a stab at a fix for this here

Hope that helps!


Dave Dunn said...

I'm currently experiencing the same issue and found this Hotfix from MS: Hotfix 955586.
I have yet to actually try it, but will probably have to impliment that Hotfix shortly.

Hopefully that helps!

Joe said...

Lars: I tried playing around with the versioning settings of a list. The thing is versioning settings are limited on List (no minor/major version contrary to document libraries). I will try it on a document library to see if it helps solving this problem.

Leon: While a visual studio solution might definitely solving this problem. It sometimes is just too much for a specific problem. In this case a simple SharePoint Designer workflow might do the trick if you start the workflow by checking the approval status.

Dave: Thanks for the tip. I will check this hotfix soon.

PrashanthSpark said...

really thanks for the information. i was about to commit for this to my cleint today. helped me in backing offf now... sad point basic things are weired in sharepoint