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)

Super Method

(0) ShareShare
ReportReport
Posted on by

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

I have the same question (0)
  • Suggested answer
    Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    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

  • Community Member Profile Picture
    on at

    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

  • Suggested answer
    Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    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

    if(ret)

    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()

  • Ismail Mohamed Profile Picture
    576 on at

    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

  • Suggested answer
    jaestevan Profile Picture
    1,719 on at

    "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.

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