SharePoint 2010 workflow stuck on starting
Using SharePoint Workflow (in fact, Nintex, but it applies to “standard” SharePoint workflow, after all, Nintex is just standard workflow with a few bells and whistles) on a document library and a workflow that is set to auto-start on document creation.
The symptoms were: if you add a document to the library, then the workflow fires, but it sits forever in a state of “starting”. However, if you manually start the workflow on the same document, then it runs absolutely fine.
There are a few more details here. As, in fact:
- If your workflow is running on the standard document CT, with no metadata, then it will auto start fine
- As (1) above, but with some simple metadata, then it will auto start fine
- As (1) and (2) above, but with a custom CT, then it will auto start fine
- As 1-3 above, with some simple metadata that is required, then, it should start fine.
- As 1-4 above, but with complex metadata (e.g., Lookup field) that is required, then this is when it doesn’t work.
To clear up what’s going on, the “starting” state is supposed to be a holding position, that SharePoint uses to wait until your document is checked in. I assume that SharePoint workflow is waiting for an event receiver that indicates the document was checked in.
Hence, if you don’t have any versioning/checkout OR required metadata on your item, then the workflow is able to start OK. If you do have some required metadata, but it’s one of the simple types (single line of text, yes/no, etc.) then it does appear to work OK.
But in my case, where I had a lookup column on my custom content type, where the field was required, the workflow simply wouldn’t start. No errors in the event logs - it just sat there, waiting, forever (alone). It would appear to be some sort of issue with SharePoint notifying (itself?) that the document has been checked in when the field is a lookup column - i.e., the “checked in” event receiver wasn’t firing, either correctly, or at all - thus the workflow never re-hydrates (wakes up.) Bizarre.
Time constraints meant I haven’t been able to look in to it further, but will hopefully do so in the future. In the meantime, I implemented a simple (crude/filthy) workaround. I set the lookup column to not be required, and added a first step the workflow to wait for the item to change - and then check if the lookup field has been populated. This did the job, but is hardly satisfactory.
Notes, thoughts or similar experiences in the comments please… !