Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
    
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 '10 at 13:44
    
Can you please move your comment to an answer? This way, you can mark it as the correct answer and allow other people to contribute (and upvote). See also, Posting answers to your own question. –  Kit Menke Aug 2 '11 at 16:30
add comment

4 Answers 4

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.

share|improve this answer
    
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 '10 at 21:37
    
Do you have it set to run for a new item, a changed item, or both? –  Marc D Anderson Jan 21 '10 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 '10 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 '10 at 16:40
add comment

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?

share|improve this answer
    
that might work. I'll try that out. Thanks! –  David Lozzi Feb 3 '10 at 15:29
add comment

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

share|improve this answer
add comment
up vote 1 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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