0

This question already has an answer here:

Workflow Vs Event Receiver I have a list in a site collection called projects. I have a workflow on Item Added and now currently in the process of creating Event Receiver.

I would like to know which actually gets trigged first. Event Receiver or Workflow?

Thanks..

marked as duplicate by Mike, Waqas Sarwar MVP, Robert Lindgren Aug 4 '15 at 6:52

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

Item Added is an Asynchronous event receiver, so your workflow can run before the event receiver or after as well.

This Question is same as yours posted here.

It Says :

  • 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.

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.

And 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.

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