Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Adding new parameter to table method using extension

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,

As the title say - I'm trying to add new parameter to table insert() method using extension. 

In my extension model I've created a class which extends said table and I've added new method there with exact same signature as in base table, only with new parameter. Then when I try to call insert in extension model class, it doesn't recognise my change. Is it possible to override base methods this way? Is there other solution to this problem?

Regards,

Lukasz Wozniak

*This post is locked for comments

  • Martin Dráb Profile Picture
    Martin Dráb 230,934 Most Valuable Professional on at
    RE: Adding new parameter to table method using extension

    No, it's not possible by extensions. And if it was possible, all existing code using the method would stop working, because it wouldn't be provided the second parameter value. Therefore all you would achieve the breaking your ERP system. But you can easily create a new method with two parameters and call it from your code.

  • Manish1607 Profile Picture
    Manish1607 45 on at
    RE: Adding new parameter to table method using extension

    Is there any way to achieve method overloading kind of feature.  I have a base method initQuery(SalesId), which i want to extend using chain of command and want to add extra parameter for JoinType...

    so new method would look like initQuery(SalesId,JoinType).

    Any work around ?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Adding new parameter to table method using extension

    Thank you for your answer Martin.

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,934 Most Valuable Professional on at
    RE: Adding new parameter to table method using extension

    No, changing a method signature in extensions (and having different package seeing two different parameter profile of the same method) isn't possible.

    Nevertheless your attempt is doing something else. You said you'd created another method with the same name and different parameters, which is method overloading - and this concept isn't supported in X++ either.

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…

Vahid Ghafarpour – Community Spotlight

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

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,934 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans