Notifications
Announcements
No record found.
Hi,
When ever I need super()?When should I write my code before super method and when afterwards?
thanks
*This post is locked for comments
Each object (Form, class, report, method) in AX has any parent class. That parent class can be an x++ class or a kernel class. Super() means calling a method with the same name in parent class.
Writing code before super() means, doing something before "execution"
writing code after super() means doing something after "execution"
lest take example of \\Data Dictionary\Tables\CustTable\Methods\insert
now here in this method, writing code before super() means doing ANYTHING before insertion of record
Opposite to that writing code after super() means doing ANYTHING after record is inserted in CustTable
Thankx for your quick answer :).
For example i override the modified() method for a control with the following code:
public boolean modified()
{
boolean ret;
ret = super();
if(ret)
...
}
return ret;
can you please tell me what the code does?
Thanks
by definition This method is called from the modified method on controls if the validation methods returned true.
whenever the control is modified this method invokes. The super call manages the table update (by a sequence of calls to validate on the data source, validateField on the table, and modified on the data source).
and when your write following
that means if validations are true or in other words if control has been modified correctly.
now lets suppose if you want to do something before value is actually changes, you can puts you code before super()
else, if you want to do something after value is modified, you can write code after super()
if i have command button with super. how i can access to the parent class
Ex. batch order form has Create and Cancel
if i go to design i found Command Button for Create named Ok with no method
and if i override any method like
void clicked()
super();
now how i can access to parent class
"Command" buttons have implicit kernel commands linked to them, therefore the super() call is a kernel action that is not part of any X++ debuggable object. For regular buttons (no-command), super class can be deleted as by default it does nothing (you are supossed to implement your own actions on the clicked method).
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 4 Most Valuable Professional
Priya_K 4
MyDynamicsNAV 2