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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

CoC applied on same method by developers

(0) ShareShare
ReportReport
Posted on by 314
Hi team,
 
Suppose, In table SalesTable > Insert method, two developers wrote code in Extension class by using CoC method.
 
For example -
Developer 1:
 
ExtensionOf(Tablestr(SalesTable))
final class SalesTable_extension
{
       public void insert()
{
     // Custom code
       next insert();
}
}
 
Developer 2:
 
ExtensionOf(Tablestr(SalesTable))
final class SalesTableTwo_extension
{
       public void insert()
{
     
       next insert();
// Custom code
}
}
 
here my question is in which order the both code will execute? I mean which code will first execute and then the next one.
 
Kindly elaborate please.
 
thanks!
 
 
Categories:
I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    239,762 Most Valuable Professional on at
    This is what F&O documentation (Class extension - Method wrapping and Chain of Command) says:
     
    The system randomly runs one of these methods, such as the doSomething method of the BusinessLogic1_Extension class. When the call to the next doSomething method occurs, the system randomly picks another method in the CoC.
     
    Therefore if you need two things that runs in a specific order, using two CoC extensions of the same method isn't a viable design. You'll need to do it differently.
     
    By the way, two developers working on the same product typically shouldn't create two extensions of the same object. You'll may have two extensions when you have two products in a same environments, such as an ISV solution and customer-specific adjustments.
  • CU10121822-0 Profile Picture
    314 on at
    Thanks Martin,
     
    What I understood, We shouldn't write extension for same objects multiple times. We should use the existing one only which is already present.
     
    As you said Therefore if you need two things that runs in a specific order, using two CoC extensions of the same method isn't a viable design. You'll need to do it differently.
     
    Kindly elaborate, what will be the alternative solution?
     
    thanks!
  • Martin Dráb Profile Picture
    239,762 Most Valuable Professional on at
    What you should do depends on what exactly you want to achieve. If you want to discuss a particular scenario, please tell us what it is.
     
    Just to give you one example, you may have a CoC extension of insert() calling a class method (e.g. new MyBusinessProcess().doStuff()) and another model extending doStuff() 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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

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

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 554 Super User 2026 Season 1

#2
André Arnaud de Calavon Profile Picture

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

#3
Subra Profile Picture

Subra 422

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans