Hi All,
Can you please let me know the CoC is behave like Event handlers (Pre OR Post ) ? Means can i use Event handlers (Pre OR Post ) instead of CoC ?
Please give me more shed on this.
Thanks!
Hi All,
Can you please let me know the CoC is behave like Event handlers (Pre OR Post ) ? Means can i use Event handlers (Pre OR Post ) instead of CoC ?
Please give me more shed on this.
Thanks!
Hi @rp@n,
Here is a blog with code samples for you to understand community.dynamics.com/.../ax7-d365-chain-of-command-with-example . You can write your code and test it.
You can add some pre and post event handlers and call them together with chain of command methods to test how they relate to each other.
Then you can see the pre and post event handlers run after and before the chain of command calls. So chain of command wraps the base method, and its pre and post event handlers all together. Just as chain of command, the event handler methods are also called in a random order.
If you read the official documentation you'll notice the handlers are not talked about much, instead chain of command is the preferred way. It has more features and is easier to read. You don't need a pre and a post handler but can do one method and just call next, and do logic before and after. You also have the benefit of being inside a class instance so you can add member variables, call protected methods, etc.
docs.microsoft.com/.../extensibility-home-page
I think I have mentioned this in other posts from you - you have valid questions but seem to be missing basic knowledge. I'm still encouraging you to seek out training somewhere since you will greatly benefit from someone just going through these basics with you, as opposed to you having to come here and ask basic questions and waiting for replies.
As usual, you can find answer to many "can I?" questions by simply trying it. As already pointed out by others, yes you can use event handlers instead of CoC. But usually it doesn't make sense to use event handlers in scenarios where CoC is possible.
Yes, you can, the question is why you would ever do it. CoC was developed to overcome many limitations of these handlers and I'm not aware of any good reason for using the legacy approach. Simply don't do it despite the fact that you can.
It depends.
e.g. if you want to make use of local variables Event Handlers can be less handy as compared to COC.
André Arnaud de Cal...
292,884
Super User 2025 Season 1
Martin Dráb
231,758
Most Valuable Professional
nmaenpaa
101,156
Moderator