I have an event receiver, and I'm capturing the "ED" events (Added, Edited). I also have a Workflow on the list that is triggered on Item Added and Updated. Does the workflow get called before the event receiver or after?

  • Hi kurtnelle, just leaving a notice here. I have retagged your question with some more specific tags - we prefer to leave the 2010 tag only for question that are really specific to that SharePoint version. Fell free to re-add it if you belive it is the case (for example because you have evidence that the behaviour has changed from SP2007), otherwise is enough to reference the SharePoint version in the question. If the need arise, you could just add the tag later. – SPArcheon Nov 6 '12 at 14:41
  • Also notice that more specific tag will help to draw more people to the question, and improve search for any user with the same problem in the future. – SPArcheon Nov 6 '12 at 14:44
  • possible duplicate of Execution order of event receivers and workflow on a list – Vikalp Kapadiya Jul 1 '13 at 7:01

I found the following answer by Chris O'Brien

If a list has workflows defined which are set to auto-start, these will always execute before any other 'ItemUpdated' or 'ItemCreated' event receivers by default. It is possible to re-order these in code however - I needed to do this once as for some reason I needed a receiver to fire before the workflow did it's processing. To re-order, simply get the SPList.EventReceivers and modify the Sequence property of each one you want to change (and call .Update()).

Remember though, that if someone disables workflow and then configures it again (with auto-start), SharePoint will add the SPWorkflowAutostartEventReceiver back in as Sequence=1, meaning the re-ordering would need to happen again.

  • 2
    In addition check Synchronization property. Set it to Synchronous to guarantee your code run before workflow. msdn.microsoft.com/en-us/library/… – Dmitry Kozlov Nov 6 '12 at 14:34
  • 1
    So, its more about determining when the SPWorkflowAutoStartEventReceiver, EventReceiver executes. That makes perfect sense. – user2903 Nov 6 '12 at 15:08

Events Added and Updated run asynchronously by default. So workflow can run before your event handler as well as after. http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.speventreceiverdefinition.synchronization.aspx


If you want the -ed ending events to be executed before the workflow, you should set them as synchronous events and not as asynchronous which is the default value. If so (synchronous), the events will always be executed before the workflow.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy