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
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.
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 ?
Thank you for your answer Martin.
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.
André Arnaud de Cal...
292,160
Super User 2025 Season 1
Martin Dráb
230,934
Most Valuable Professional
nmaenpaa
101,156