2

As per my requirement, I need to apply TWO event receivers on the same SPLIST, say "myLIST1".

The first event receiver is already written by my colleague.And I want to apply another set of functionality on the same "myLIST1" based on the change of a particular list column.[say targetresolutiondate].

If authorized person came to the SPLIST and change the targetresolutiondate column to a future date [ greater than today], I have to fetch this value and navigate it to another document library and manipulate some doc lib items' metadata.

I want to apply ItemUpdated()

  • So, is your question about whether it's possible to have two event receivers on the same list, or how to implement an event receiver which catches targetresolutiondate-column's value and if it's a date in the future, you do <something>? – moe Jun 27 '17 at 6:40
  • my question is, whether its possible to have two event receivers associated with the same SPList and not "HOW TO". whether SharePoint supports this kind of functionality in SSOM – SaMolPP Jun 27 '17 at 7:57
  • 1
    I believe you'll find this helpful: sharepoint.stackexchange.com/questions/129392/… – moe Jun 27 '17 at 8:56
3

Yes, it's possible to have multiple event receivers on the same list, but why you need to do that? you can add the new event function Itemupdating to the current event receiver solution!

Regarding fetching

  • In case you need to fetch the old value use Itemupdating with properties.ListItem
  • In case you need to fetch the new value use Itemupdating with properties.AfterProperties or ItemUpdated as you like !!
  • I prefer itemupdated() eventhandler instead of itemupdating() with synchronous as the value in elements.xml file. – SaMolPP Jun 27 '17 at 9:42
  • Bro, why you prefer that? to handle the synchronous use ItemUpdating instead of the ItemUpdated (asynchronous) event in order to access the old value – Mohamed El-Qassas MVP Jun 27 '17 at 9:47
  • :-) in my case, authorized person will access this list and make changes to this field- targetresolutiondate - and set it as Future Date - and i need to compare this Future Date is Greater than Today's date. so i think i can directly access the currentlistitem["targetresolutiondate"] without using properties.afterproperties . I have tested similar functionality with itemupdated event. and it was working as expected. – SaMolPP Jun 27 '17 at 10:20
  • Bro, this is not my point now, I talk about old value, in case you don't need to fetch it okay use itemupdated but as told you, you should distinguish between synchronous and asynchronous events. So I answered with additional info where you need to know only the possibility ?!! finally what's the wrong now in my answer!! :) – Mohamed El-Qassas MVP Jun 27 '17 at 10:28
  • Sorry for the confusion! :-( I never said your answer is wrong. It was nice to see that , you are offering help and your time to let others learn the intricacies of SP. Thanks Again! :-) – SaMolPP Jun 27 '17 at 10:33

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.