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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Replaceable in d365fo

(0) ShareShare
ReportReport
Posted on by 30

Hi all,

I go through below link for replaceable features

https://kashperuk.blogspot.com/2017/10/development-tutorial-extensibility_7.html

Not understand properly,  kindly give me difference between CoC & Replacable.

Kindly elaborate me pls with one example for replaceable 

Pls give me more shed on this 

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    299,576 Super User 2025 Season 2 on at
    RE: Replaceable in d365fo

    Hi Arpan,

    CoC and Replicable cannot be compared. Replaceble gives you a variation for the CoC extension method. Usually, you must call the next() statement in a CoC method which will then execute the standard logic before or after your extension coding (depending on the position in your method).

    When the original method is decorated with the attribute Replaceable, you can skip the next() method which will result that you fully replace the standard business logic with your own logic.

  • @rp@n Profile Picture
    30 on at
    RE: Replaceable in d365fo

    Thanks Andre

    Kindly let me know which option is more reliable to use?

    I mean replacable attributes to bypass next keyword or

    Next keyword to use?

    Kindly elaborate please

  • Martin Dráb Profile Picture
    236,570 Most Valuable Professional on at
    RE: Replaceable in d365fo

    If the developer of the method you're extending didn't use Replacable, you must call next(). There is no choice.

  • @rp@n Profile Picture
    30 on at
    RE: Replaceable in d365fo

    Sorry  not understand

    Kindly elaborate please

  • Suggested answer
    Martin Dráb Profile Picture
    236,570 Most Valuable Professional on at
    RE: Replaceable in d365fo

    If you're using CoC to extend a method, whether you can skip next() depends on whether the developer of the method (usually Microsoft) decorated it with the Replaceable attribute. If not, the method isn't replaceable and you must call next.

    If the method is decorated with the replaceable attribute, then you can decide whether you want to extend it (running both the stadard logic and yours) or replace it (not calling the standard logic).

    Is it clear now? If not, go and try it to see it for yourself.

  • @rp@n Profile Picture
    30 on at
    RE: Replaceable in d365fo

    Yes Martin clear now.

    Let me check, will update you

  • @rp@n Profile Picture
    30 on at
    RE: Replaceable in d365fo

    Yes, that means if the method is decorated with replacable attributes than only we can use replacable. Else never.

    we needs to go for CoC only.

    If we use replacable,  than we can only run our logic and bypass absolutely standard logic . But depends upon our requirements whether we use CoC or replacable.

    Am I correct?

  • Martin Dráb Profile Picture
    236,570 Most Valuable Professional on at
    RE: Replaceable in d365fo

    No, there is no decision whther to use CoC or replaceable. You'll use CoC in all cases. Whether you can replace the method depends on whether the other developer decorated with replaceable. You can't use Replaceable attribute when extending a method; you could use it when defining a method that others can replace.

    It's not rocket science, you just need to think about it a little.

  • ergun sahin Profile Picture
    8,824 Moderator on at
    RE: Replaceable in d365fo

    In 2012, when we added a button to the form, we overwrite the clicked method, super didn't have a function because we had the code do the work.

    Similarly, if the developer of the function you will write COC has written this method to be overwrited or if he does not see any harm in overwrited it, he states this on the method and gives you the authority to overwrite the super (next) in CoC.

    They are not exactly the same as the button example, but I used them to help you understand the logic of the topic.

  • @rp@n Profile Picture
    30 on at
    RE: Replaceable in d365fo

    thanks Ergun, little bit understsnd

    can you pls provide me the example of codes with used replacable.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 1,771

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 542 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans