I have SharePoint list. I have added Event receivers on SharePoint list for ItemAdded event.

Also I have SharePoint designer workflow on same list which triggers on Item created and Item Updated.

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

Please explain reason. also I would like to know if I have ItemUpdated event receiver and Designer workflow for trigger when item get updated.


Answer by Chris O'Brien - MVP for Execution order of event receivers and workflow on a list

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.

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