Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Detecting default parameters when calling next method in extension classes.

(1) ShareShare
ReportReport
Posted on by 87
Hello,
 
I have a technical issue that i think is important for a correct standard code preservation.
 
Let's say i have an standard class:
 
public class A
{
     public ExampleEDT test(String _a, String _b, boolean _c=false, boolean _d=false)
     {
          ExampleEDT      ret;
          if(primisDefault(_c) && primisDefault(_d))
          {
               //some if code
          }
          else
          {
               //some else code
          }
          
          return ret;
     }
}
 
Then i create a test() method extension:
 
[ExtensionOf(classStr(A))]
public class A_Extension
{
     public ExampleEDT test(String _a, String _b, boolean _c, boolean _d)
     {
          ExampleEDT ret;
         
          ret = next test(_a,_b,_c,_d);          
 
          return ret;
     }
}
 
 
I detected that, even when initially i call the test method 'a.test(string1, string2)' without using the extension, the standard code works as expected entering the first 'if', detecting _c and _d parameters as default. BUT, when using the extension it doesn't detect as default parameters. so the logic on the standard method doesn't work properly. (entering in the else part). The problem I see, is that I must call the next method using all the parameters (not only the mandatory) otherwise i get a runtime error.
 
In some cases, i can resolve this situation bringing the standard method logic to the extension's method, but in my opinion this is a bad practice since i am ignoring the standard code (and future changes).
 
 
I would like to know if there is any way to preserve the @_isDefaultSet property between extensions and standard classes
 
 
Thanks in advance,
Eisenberk.
 

 
  • Basti Aurand Profile Picture
    Basti Aurand 160 on at
    Detecting default parameters when calling next method in extension classes.
    I also faced this issue today. So it's still existing. No bugfixing from MS as far as I experienced. Is there any solution or is this just by design and we will have to do some workaround. What could be a workaround?
     
    I would realy appreciate any hints on this
  • Layan Jwei Profile Picture
    Layan Jwei 7,715 Super User 2025 Season 1 on at
    Detecting default parameters when calling next method in extension classes.
    Hi Eisenberk,

    I tried it now and faced the same thing. Maybe it's a bug that needs raising with Microsoft.
     
    Thanks,
    Layan Jweihan
    Please mark the answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,407 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans