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

Private method not supported in D365fo

(0) ShareShare
ReportReport
Posted on by 30

Hi,

As we know that CoC not supported Private method . If required to use Private method in CoC, then we need to raise " Extendibility service request " to MS.

Is it same concepts for any methods like which is private in entire applicaton,   if required to add or modify  some code then required to contact MS or is this only for COC?

Please give me more shed on this 

I have the same question (0)
  • Verified answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Arpan,

    Apart from using CoC, the only option is to "Copy event handler methods". That is not possible for protected and private methods until and unless the method has been marked with Hookable(true) or if it has a delegate.

    For an example, you can check the method getRemainBeforeQty in class SalesFormLetter. It has a delegate defined which can be used for some modifications.

  • Verified answer
    Blue Wang Profile Picture
    on at

    Hi @rp@n,

    Methods that are declared as private can be called only from methods in the class where the private method is declared.

    So, you cannot create event handlers or use CoC to customize private methods simply. You need to raise " Extendibility service request " to MS.

    About mentioned Hookable , check your old thread: community.dynamics.com/.../851612

  • @rp@n Profile Picture
    30 on at

    Thanks Gunjan and Blye,

    Apart from CoC, If we need to required to add or modify any ( Private or Protected methods )then the Hookable attribute should be TRUE  like

    HookableAttribute(true), Then only we can proceed further in to those methods...

    Is it right?

  • Verified answer
    Blue Wang Profile Picture
    on at

    Hi @rp@n,

    If you can customize the method, you can make it hookable.

    Another way is to use reflection, but not recommended. Just know.

    Because once Microsoft changes this private method, your code will be useless.

    If you are sure that you need to modify this private method, it is best to apply for extensibility.

    Can you tell us why you need to modify private methods?

  • Verified answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    You can add private methods in the same way as non-private methods. Regarding modifying, you can modify your code but not standard code, and it has again nothing to with the access modifier.

    The Hookable attribute is used for extensions, not for adding and modifying methods.

  • @rp@n Profile Picture
    30 on at

    Hi.all,

    It's not my requirement.  I am just asking for the best approach to do modification if required.

    That's it

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    I believe we've covered the topic. If there is something you still don't understand, read the answers once more and if it doesn't help, explain your actual problem. Just saying "It's not my requirement" doesn't allow us to help you.

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 503 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans