Skip to main content

Share Point

Go Search
Home
Announcements
Who Are We
Blogs
  
Share Point > Tips & Tricks > Automaticly starting workflow problem on document libraries  

Web Part Page Title Bar image
Automaticly starting workflow problem on document libraries

You have to be very careful when you want to create custom workflows on WSS 3.0 ( and also on MOSS 2007).

There are two steps of uploading a document on a document library. On the first step, the user uploads the document, and on the second ( optional ) step the user enters the needed information for the extra columns that are defined on the document library or the selected content type of the document.

There is a problem in WSS 3.0's design. Let's say you have created a workflow and you set it to start automaticly after the document is uploaded. After the user uıploads the document in the first step, the workflow starts without waiting for the user to enter the needed information for the extra columns on the document library or the selected content type of the document.

So, in this situation, there are two possible actions that SharePoint takes:

  1. If the extra columns are optional, the workflow starts after user uploads the document, and while the user enters the values of the extra columns, since the workflow automaticly started, it reads the values of these extra columns as empty, so, the workflow does not work properly if the workflow uses the values of these columns as parameters.
  2. If at least one of the extra columns is required, since the workflow can not read the empty value of the required column, after the first step, the user gets the "An unexpected error occured" error before the user can enter the values for the extra columns; so the second step fails. After the error, the document stays checked out to the user. When the user wants to check in the document, SharePoint does not let this action because there are empty valued required columns. When the user wants to edit the properties of the document, the user gets the same "An unexpected error occured" error since the workflow locks the colums.

There is no way out of this issue. By design, when an automaticly starting workflow is configured for a document library, if the library has a required colum, the workflow and document uploading processes lock each other.

As a solution, you may think of pausing the workflow for some time as a first action and letting the user enter the required column values for the document, but I have tried that one; sorry :( , it does not work for required extra columns.

I want to share someting I faced. I have created a document library which holds two content types of documents. In my automaticly starting custom workflow, I get the content type of the uploaded document. I uploaded my document, and the system redirected me to the second step. But, while I was selecting the content type of my document, the workflow already started, and it used the default content type of the document library as the content type of my document. I had a required extra column on my non-default content type and I have set this content type as the default content type. I uploaded anothet document, and surprise!! :P I got the "An unexpected error occured" error.

I have no idea if this is a bug or this is by design. I hope this situatin to be a bug, so it can be fixed with a service pack. But, if it's by design, we may have to wait for the next version of the SharePoint products.