how can I use CoC with method whose signature includes default values , CoC signature does not accept default and method itself may be called with number of parameters less than defined in CoC signature ?
how can I use CoC with method whose signature includes default values , CoC signature does not accept default and method itself may be called with number of parameters less than defined in CoC signature ?
Hi Sanjay kumar singh,
As per my comment just above , I tried what you shared but it does not work with me
Please go through,
I try to use CoC for static method PayrollPayStatementBenefitLine::create to add some extra logic
I add all parameters in CoC method signature and I can build the model successfully
when I run generate pay statement, the execution is interrupted
when I check the standard calling of this method I find that it is called some times with number of input parameter less than that in CoC signature
You can still get the default values from the same parameters which are in the method signature.
CoC = Chain of Command. In an extended method you just omit the defaulting in the parameters:
void doSomethingWithTheItem(ItemId _itemId = itemId) becomes
void doSomethingWithTheItem(ItemId _itemId) in an extension, but the ability to get a default value remains.
This is the basics.
Hi,
Can you please elaborat what you try to achieve and write the complete text of your abbreviation at least once?
Many thanks,
Ludwig
Please check the documentation: [View:https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/extensibility/method-wrapping-coc#what-about-default-parameters:750:50]
Methods that have default parameters can be wrapped by extension classes. However, the method signature in the wrapper method must not include the default value of the parameter.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,252 Super User 2024 Season 2
Martin Dráb 228,089 Super User 2024 Season 2
nmaenpaa 101,148