General X++ Development
When should I use Chain of Command vs an event handler?
When should I use Chain of Command vs an event handler?
1 answer
Write an answerI use Chain of Command when I am intentionally extending a method and need logic before or after that method.
I use an event handler when the framework already exposes an event that represents exactly what I care about and I do not need to wrap the method.
If CoC gives me the exact method I need, I usually prefer it because the execution path is easier to follow in the debugger.
If the event is the real business event I care about, use the event instead of wrapping some random method just because it happens to fire nearby.
Know the solution?
Sign in to contribute an answer and build your community reputation.
Sign in to answer