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 :
Microsoft Dynamics AX (Archived)

Adding new parameter to table method using extension

(0) ShareShare
ReportReport
Posted on by

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

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    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.

  • Community Member Profile Picture
    on at

    Thank you for your answer Martin.

  • Manish1607 Profile Picture
    45 on at

    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 ?

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

    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.

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans