web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

next() or super () in D365FO

(6) ShareShare
ReportReport
Posted on by 1,323
Dear team,
 
As I have used practically next() with extension class. For example -
 
Table - CustTable -- Insert()
 
Used CoC-
 
next insert ()
 
Here the next keyword called the base method on insert from the CustTable.
 
AX2012-
 
Super ()
 
Here if I do the same for CustTable -- Insert method. 
 
So, the super() , what it will return?
 
Kindky advise pls.
Categories:
I have the same question (0)
  • Suggested answer
    Huggins Mafigu Profile Picture
    511 on at
    See below,
     
    ​public void insert()
    {
      //your code here
    
      next insert();
    }
     
    You don't use super() in CoC.
     
    Your method will look like the snippet above
     
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    303,669 Super User 2026 Season 1 on at
    Hi,
     
    In Dynamics 365 for an extension class, you don't use the super() command. You can write code before or after the next() statement in Dynamics 365 to have code executed before the main coding or after that logic. 
    public void insert()
    {
      //your code here to execute logic before the coding you need to extend
    
      next insert();
    
      //your code here to execute logic after the coding you need to extend
    
    }
     
  • Layan Jwei Profile Picture
    8,165 Super User 2026 Season 1 on at
    Hi,
     
    You can only use super() if the class and method is created by you.
     
    But in extensions (CoC), we always use next, we don't use super.
     
    So if the standard method was like this
    Info("hi");
    super();
    Info("bye");
     
     
    When using CoC, you need to use next().
    If you put ur code before next(), ur code will be executed before the method runs, which means before info("hi")
    And if you put it after next(), your code will be executed after the method runs, which is after info("bye")
     

    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future.

  • CU05031448-0 Profile Picture
    1,323 on at
    Hi Layan, as you said
     
    "We can only use super() if the class and method is created by you."
     
    ---- What I understood,
     
    So, for my CUSTOM class, tables or forms methods I can used super as you mentioned in D365FO.
     
    My question is
     
    For example -
     
    1. CustTable - Insert method 
    It's having super. But we can't used that. We should do for next insert() to call itt.
     
    2. My custom Table - Insert method
    I can use super here in D365FO 
     
    My custom code 
    super ();
     
    ***My question is when the super is getting called for my custom table for insert method, what it will call internally ?
     
    Kindly elaborate pls.
     
    Thanks in advance.
     
  • Suggested answer
    Martin Dráb Profile Picture
    239,022 Most Valuable Professional on at
    super() is used with table inheritance. For example, ClassA has method1() with some logic and you create ClassB inheriting from ClassA. Then you can override method1(), add some extra logic there and use super() to call the code in the parent class (i.e. method1() in ClassA). Note that the behavior of ClassA didn't change. This applies to both AX 2012 and F&O.
     
    next is used with extensions, e.g. you create ClassA_Extension class and adjust the behavior of ClassA.method1(). This is a new concept in F&O; it doesn't exist in AX 2012.
  • CU05031448-0 Profile Picture
    1,323 on at
    So, Martin what I understood 
     
    AX 2012-
    Class B extends Class A
    {
          super();  // is here super is called the Class A ? 
          Add my custom Logic
    }
     
    D365FO -
     .
    extension of(TableStr(Class A))]
    final pubic class ClassA_Extension
         next method1();
         // Add my custom code here
    }
     
    Am I correct?
  • Martin Dráb Profile Picture
    239,022 Most Valuable Professional on at
    No, you aren't. Maybe you should read my reply once more.
    Your two examples do very different things and you're wrong in thinking that inheritance was removed in F&O.
  • Suggested answer
    Navneeth Nagrajan Profile Picture
    2,533 Super User 2026 Season 1 on at
    Hi CU05031448-0,
     
    To add to the explanation provided by Martin the correct logic for Class level inheritance which is applicable in D365 FO and Ax2012 R3 is mentioned in the example.
    Class A
    {
        protected void method1()
        {
            //Base logic is here.
        }
    }
     
     
    Class B extends Class A
    {
       
         //Override method1() here and then this will 
         protected void method1()
         {
               super();
               //Extra code goes in here
          }
    }
     
    In D365FO in case of COC the behaviour is the extra logic will run either before or after the standard logic and this is based on the requirement in hand.
     .
    extension of(TableStr(Class A))]
    final pubic class ClassA_Extension
         next method1();
         // Add my custom code here
    }


    Hope this helps. Happy to answer questions, if any.
  • CU05031448-0 Profile Picture
    1,323 on at
    Thanks Navneeth,
     
    So, in D365FO, we no need Class B? as the code you suggested.
     
    Kindly advise pls 
  • Martin Dráb Profile Picture
    239,022 Most Valuable Professional on at
    Of course you still need inheritance! For example, if you want to create a new SysOperation controller, you'll create your own class (ClassB) extending SysOperationServiceController (ClassA) and you may override base methods.  Creating a child class and extending a class are two completely different things and each has its own purpose.
     
    Extensions have been added to F&P not to replace inheritance (which they don't), but as an alternative to modifying code of standard classes (which was possible in older versions but it's not in F&O).

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 617

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 461 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 298 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans