Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

How to call a TABLE private method ?

Posted on by Microsoft Employee

 Hello everyone,

I need to call a Private static method of the SalesTable table from an extension. I have seen some examples of Reflection for classes and forms but I haven't seen any example for Tables. Is it possible ?

This is my code:

codeError.png

This is the error message:

errorMesg.png

Any idea ?   Thanks.

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to call a TABLE private method ?

    Thanks everyone I tried other approach to my requirement.

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: How to call a TABLE private method ?

    What version are you on? There should be method SalesTable.initFromCustTable. Note: this method is in SalesTable table.

    You should not invoke private methods, they are not intended to be use from the extensions. Even if you managed to do that (it is technically possible), you risk your solution breaking during any application update, since MS may change the private methods at any time. The clear best practice is to extend only public and protected methods.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to call a TABLE private method ?

    Thanks for your answer.

    Ievgen, can you tell me how can I call the private method ? please.

     I took a look on the SalesTable and did not see a Public initFromCustTable. Anyway I'm evaluating if I can use another approach but I'd like to know how I can invoke a Table Private method.

    Thanks.

  • Suggested answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: How to call a TABLE private method ?

    Hi BetoPR,

    It is possible but not recommended. Why do you need to call initfromCustTableServer at all? There is public method "initFromCustTable" that will call it anyway, so just use it!

  • Suggested answer
    Jie G Profile Picture
    Jie G on at
    RE: How to call a TABLE private method ?
    Hi,
    It is recommended to create an extensibility request.
    Please refer to: Create Microsoft Dynamics 365 for Finance and Operations – Extensibility requests in LCS

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans