Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

Replaceable in d365fo

(0) ShareShare
ReportReport
Posted on by

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 

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

    @rp@n, you have an example in the blog post that you linked at the very beginning.

  • ergun sahin Profile Picture
    ergun sahin 8,812 Super User 2024 Season 1 on at
    RE: Replaceable in d365fo

    It's not very complex. Think of any CoC method. You just don't have to put the "next ..()" line.

    Of course, if you don't type Next, the standard logic will not work.

    There is an example in the link you provided. If you pay attention, according to the result of the "if" line, custom logic is running,(not next).

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

    thanks Ergun, little bit understsnd

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

  • ergun sahin Profile Picture
    ergun sahin 8,812 Super User 2024 Season 1 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.

  • Martin Dráb Profile Picture
    Martin Dráb 230,817 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.

  • @rp@n Profile Picture
    @rp@n 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?

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

    Yes Martin clear now.

    Let me check, will update you

  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,817 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
    @rp@n on at
    RE: Replaceable in d365fo

    Sorry  not understand

    Kindly elaborate please

  • Martin Dráb Profile Picture
    Martin Dráb 230,817 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.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,817 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans