public class MyUpdateListener : IPreUpdateListener
{
public bool OnPreUpdate(PreUpdateEvent @event)
{
// What do I return from this method - true or false?
}
}
I've wondered about this too and was unable to find a definitive answer. So I pulled down the 2.1.1.GA source code and found the answer: returning true from OnPreInsert, OnPreUpdate, or OnPreDelete will veto (i.e. cancel) the respective insert, update, or delete operation. The remainder of the "Pre" listeners return void.
The most common use of IPreInsertListener and IPreUpdateListener is to add record level auditing and for those tasks you should return false.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With