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 list with 2x declarative approval workflows associated with it (the workflows themselves are copies of the OOTB Approval workflow and were built in SharePoint Designer 2010).

FYI: The items in my list go to a department for initial approval, and once they're approved they get routed to a second department for additional approval (i.e. the approvals happen in serial).

Workflow #1 is kicked off programmatically in my list's ItemAdded event, and I was hoping to kick off workflow #2 in the ItemUpdating event by checking if workflow #1's status column had just been set to Complete or Approved.

My problem however is that the ItemUpdating event does not seem to fire when workflow #1 is approved (even though the auto-added workflow status column on my list is updated to Approved).

FYI: I confirmed this by outputting trace messages to the ULS logs at the start of the event. These messages appear when editing the list items manually, but not when the workflow status changes.

Does anyone know how I can programmatically determine when a workflow status column is updated (preferrebly using the list's event receiver) so that I might manually start a second workflow?

share|improve this question
    
can you move items between lists for each steps ? –  Steve B Jan 18 '12 at 16:27
    
I'm not sure what you mean here Steve. Can you please elaborate? –  Nick Larter Jan 20 '12 at 3:23
    
If you think with "states" of the documents, you can use one library for each state. Changing state of an item will consists in moving the item from one library to another. Each library can have it's own approval process, which ends by moving the item to its next state (or previous, or close, etc. depending on your requirement). –  Steve B Jan 20 '12 at 8:34
add comment

2 Answers 2

up vote 1 down vote accepted

May be new workflow events can help you (if you are using sharepoint 2010 of course).
You can attach workflow event receiver to list and in code check workflow InstanceId. So, when your workflow #1 is completed, you can run workflow #2 on the same list item through code.
Workflow properties can be accessible using SPWorkflowEventProperties object.

share|improve this answer
    
I didn't know these existed. Thanks @Kai, this worked a treat. –  Nick Larter Jan 19 '12 at 4:47
add comment

DISCLAIMER: I am not sure whether this is the best approach since I have not tried this out; but might be a temporary solution.

When Workflow #1 updates automatically, the auto-added workflow status column may not fire the ItemUpdating event. When an approver, approves Workflow #1, you will have to somehow update the same list item, may be by updating a hidden list column. The hidden column value should help you identify that the list item has been approved. This will trigger your ItemUpdating event, even though everything is happening automatically. And then, you could trigger Workflow #2 on the same event.

share|improve this answer
    
It seems a little onerous to add and update a new hidden field when the workflow is already updating an existing one that has all the info I need. Ideally I'l like to keep my list and workflow intact and use on of the existing contructs (like event receivers etc) to trap this update. I'll keep looking for a solid solution for now... –  Nick Larter Jan 18 '12 at 7:12
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.