2

I have a simple workflow that approves a List Item. I have an ItemUpdated Event Receiver that is supposed to compute some fields and update another List Item.

My event receiver gets triggered when I manually change something in the List Item, but never gets triggered when I run the approval workflow.

1

I used a workaround. I added a custom field ItemStatus, and in the approval workflow, I make sure my field gets updated with an approval status. This way, my Event Receiver gets triggered, as it senses an update in my ItemStatus field.

  • 1
    I wonder why the Event Receiver would Ignore the Workflow status column? SharePoint has so many idiosyncrasies. – James Grizzle Oct 31 '13 at 15:29
1

Is this an Item-Updated or Item-Updating event receiver?

According to 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.

  • It was Item-Updated. Thank you for answering me, but i really don't know how to reorder event receivers. – Ana Nov 1 '13 at 15:59
  • You would change the Sequence property (lower number executes first): <Receiver> <Name>EventReceiverItemCheckedIn</Name> <Type>ItemCheckedIn</Type> <Class>SharePointFeatures.EventReceiver.EventReceiver</Class> <SequenceNumber>1000</SequenceNumber> </Receiver> or if you prefer the imperative approach, or you could do it via Powershell – James Grizzle Nov 1 '13 at 19:55

Your Answer

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

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