Skip to main content
Post a question

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id : N+pDyBvKX3pflOm/fhZseS
Finance | Project Operations, Human Resources, ...
Suggested answer

Replaceable in d365fo

Like (0) ShareShare
ReportReport
Posted on 31 Jan 2023 17:01:23 by 4

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
    231,723 Most Valuable Professional on 01 Feb 2023 at 09:22:56
    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
    8,816 Moderator on 01 Feb 2023 at 09:16:08
    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
    4 on 01 Feb 2023 at 09:02:43
    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
    8,816 Moderator on 01 Feb 2023 at 08:37:33
    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
    231,723 Most Valuable Professional on 01 Feb 2023 at 06:40:49
    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
    4 on 01 Feb 2023 at 06:17:39
    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
    4 on 01 Feb 2023 at 06:11:52
    RE: Replaceable in d365fo

    Yes Martin clear now.

    Let me check, will update you

  • Suggested answer
    Martin Dráb Profile Picture
    231,723 Most Valuable Professional on 01 Feb 2023 at 05:18:06
    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
    4 on 01 Feb 2023 at 05:12:45
    RE: Replaceable in d365fo

    Sorry  not understand

    Kindly elaborate please

  • Martin Dráb Profile Picture
    231,723 Most Valuable Professional on 01 Feb 2023 at 04:55:46
    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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,865 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,723 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans
Loading complete