Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

How To call super () in class extension in D365

Posted on by Microsoft Employee

Hi All,

I want to call the super in class extension .

Ex:super(_formControl, _filterStr);

How to I call this code in Extension Class.

It Would be great for your replay

Thanks

Arun Joseph A

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How To call super () in class extension in D365

    Thank You.

    Ya its throwing error.

    public int active()
    {
    int ret;

    if (mcrAllowPayment)
    {
       // Written some business logic
    }

    ret = super();

    if (ret)

    {

         //Extension code .. call event handler extension class

    }

    In This how it will possible.

    [FormDataSourceEventHandler(formDataSourceStr(LedgerJournalTransCustPaym, LedgerJournalTrans), FormDataSourceEventType::Activated)]
    public static void LedgerJournalTrans_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
    {

      // How can i call here. if super extecuted here:

     CustVendNACHAIATInfoTable_US.enabled(CustOutPaym_NACHA_IAT::isIATNACHAFormat(ledgerJournalTrans.PaymMode)); // this code want to executed.
    }

  • Jose Fuentes Profile Picture
    Jose Fuentes 140 on at
    RE: How To call super () in class extension in D365

    Hi Arun

    For what type of object do you want to create this class? Form, Table or another class?

    If is a class the example that I've posted may help you, but it is another type of object you have to use eventhandlers, obviously the function will execute after or before (I think that would be the "super()" function that you are searching), depending of the event,

    You may check next post

    community.dynamics.com/.../ax7-extensibility-part-3-event-handlers-and-delegates-hooks

    Regards.

    Jose

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How To call super () in class extension in D365

    Thanks

    How to declare the super() in extension class.

    Is there another way to call super() in class extension in D 365.

    For EX:

    [FormDataSourceEventHandler(formDataSourceStr(LedgerJournalTransCustPaym, LedgerJournalTrans), FormDataSourceEventType::ValidatingWrite)]

       public static void LedgerJournalTrans_OnValidatingWrite(FormDataSource sender, FormDataSourceEventArgs e)

       {

           Super()// super not allowed here...

       }

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How To call super () in class extension in D365

    Hi Jose ,

    Thanks for your reply.

    For my Scenario:

    public int active()

           {

               int ret;

               ret = super();

               return ret;

           }

    I want to Create the Extension class in D 365:

    In extension class it did not to allow the super() call.

    when I declare the super() its throws error in extension class.

    Please help !

    Thanks

    Arun Joseph A

  • Jose Fuentes Profile Picture
    Jose Fuentes 140 on at
    RE: How To call super () in class extension in D365

    Hi Arun

    If you extend a class you can override the functions, for example when you develop reports you extend the SRSReportDataProviderBase when you create  your DP Class and override processReport() method.

    The next may help you.

    Noticed that both functions must have the same sign (parameters)

    Class Main()

    {

    public void mainfunction(VendAccount _account)

    {

    // Do something for main function

    }

    }

    Class Child extends Main

    {

    public void mainfunction(VendAccount _account)

    {

    super();//execute the mainfunction for mainclass

    // Do something for child function

    }

    }

    I hope this is what you are searching.

    Regards

    Jose Fuentes

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,232 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,064 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans