web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Copy event handler method and Coc in d365fo

(0) ShareShare
ReportReport
Posted on by 30

hi,

LJT.jpg

In Ledger Journal Trans table i need to add some code in Insert method . So, i can use "Copy event handler method" to achieve the requirement Pre or Post.

Shall i achieve the same thing with the use of CoC ? 

If yes, then which option is most reliable ?

Please give me more shed on this

I have the same question (0)
  • Verified answer
    Sukrut Parab Profile Picture
    71,710 Moderator on at

    You can achieve it using both approaches. COC has its own advantage where you can  access public and protected methods, and variables of the base class.  

  • @rp@n Profile Picture
    30 on at

    Thanks Sukrut,

    "Copy event handler method" option is available only in Table?

    Please give me more shed on this 

  • Sukrut Parab Profile Picture
    71,710 Moderator on at

    You can get answer to your question by putting  little efforts at your end . Just navigate in visual studio open different objects and see if the option is available.

  • @rp@n Profile Picture
    30 on at

    Sorry,  dont have system.So, I am asking...

  • Verified answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi @rp@n,

    If you want to create CoC method, you need to create an extension class manually, copy the original method signature and put it to call, and remove default values (there is no option to copy method as in the case of event handlers).

    One more advantage of CoC is that you control that extension method signature matches original during compilation and it's quite hard to make a mistake in method parameters. In the case of event handlers, you need to retrieve parameters from the args class by name and if the parameter with the name doesn't exist you will not know this. Before I had a couple of cases when MS changed parameter name from name without underscore to name with an underscore at the beginning and it broke event handler completely, but it was compiled perfectly fine. Although this kind of change is now considered as breaking and should not happen anymore, I still under impression that using CoC is much safer and clean from a development point of view.

  • @rp@n Profile Picture
    30 on at

    Thanks Sergei

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 659 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 533 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 289 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans