2

I have a requirement to multiple Event Receivers targeting Custom List (100) that fire on the ItemUpdating method.

For one of the Event Receivers the requirement is to check that there are no related open items in another list. This check may be long-running as I need to retrieve other items.

The other Event Receiver needs to write a timestamp onto the item when its Status field is changed.

These Event Receivers both need to fire on every item update but it's important that an item cannot be set to closed if there are related child items still open and the timestamp should only be set when the status field is changed.

How do I manage the sequence of when these two Event Receivers are fired?

3

You can make use of the SequenceNumber property that is associated with the SPEventReceiverDefinition object.

https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.speventreceiverdefinition.sequencenumber.aspx

This property determines the order in which event assemblies execute. This is especially important when there are multiple assemblies that are attached to the same SPSite, SPList or SPContentType event. SharePoint Foundation event processing can be perceived as a procession of steps or machine states that occur in order until the last activity completes. The creation of the steps is not sequential, so the order of processing is specified with loosely sequential sequence numbers. Because the sequence numbers are not incremented by one, the developer can group the events in the approximate order of processing when the events are created.

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.