1

I have a doc lib that has several meta fields in it. I have a workflow that processes the doc based on these fields. Everything runs fine when the doc already exists in the library.

If we add a new one by uploading (I havent tried New) the workflow doesn't fire properly. Looking at the debugger, when I click Upload, browse to select the file then click OK, the workflow fires. At this point, my meta data is empty as it's a new upload.

Then SP sends me to the edit properties page for the doc (editform.aspx). I now fill out my meta data and click ok. The workflow doesn't fire again. If I go back into edit properties and click OK, it fires.

We need this to fire on the first edit page. As a work around I'm instructing my customer to upload it, then close it then edit it again. Not cool.

Any ideas?

flag
The workaround we ended up using is to require content to be checked out, that way on upload, the file is checked out and the WF doesn't run. Then they can fill in the meta data then click Check In and then the WF fires properly. Thanks all! – David Lozzi May 26 at 13:44

3 Answers

2

When you add a document to a Document Library, there are two steps, as you know: Upload and Edit. The Upload step is like the New step in other lists; that's when the document item is actually created. It sounds like you want your workflow to run on the item change instead. If you only want the workflow to do its thing on the first edit of the item, then make sure to set a value that indicates it has already run or compare the Created and Modified dates, etc.

M.

link|flag
Using my debugger, I see the WF fires on upload, and then when I click OK on the edit page, it doesn't fire again. It never runs to look for values to know whether or not it should run. The initial running of the wF is fine, I have proper checks in place. The issue is that it doesn't run again when I click OK. – David Lozzi Jan 21 at 21:37
Do you have it set to run for a new item, a changed item, or both? – Marc D Anderson Jan 21 at 22:56
I believe Marc is right. When you click OK on the first Edit Properties/Check In page you are actually changing the document. So your workflow needs to be adapted to this case as well. – Alex Angas Jan 22 at 0:38
It is, when I edit it after the fact, the workflow fires correctly. It's also set to run on new. It appears that when clicking OK the workflow doens't run at all, the breakpoints in the debugger never trigger. – David Lozzi Jan 25 at 16:40
1

I've seen his behavior too.

As a workaround, how about checking whether the metadata is empty and, if it is, delaying for a few minutes before rechecking the metadata?

link|flag
that might work. I'll try that out. Thanks! – David Lozzi Feb 3 at 15:29
1

Use an on Item changed activity in your workflow, if you have a task changed activity later in your workflow then this will break. Work around is to use a sequence activity and inside it put an initializeworkflow activity followed by the on item changed activity both using the correlation token from the sequence activity

link|flag

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.