Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / CoC with method whose ...
Finance forum

CoC with method whose signature includes default values

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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 ?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: CoC with method whose signature includes default values

    Hi Sanjay kumar singh,

    As per my comment just above , I tried what you shared but it does not work with me

  • Sanjay kumar singh Profile Picture
    Sanjay kumar singh 240 on at
    RE: CoC with method whose signature includes default values

    DefaultValue.pngPlease go through,

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: CoC with method whose signature includes default values

    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

  • Sukrut Parab Profile Picture
    Sukrut Parab 71,673 Moderator on at
    RE: CoC with method whose signature includes default values

    You can still get the default values from the same parameters which are in the method signature.

  • Eugen Glasow Profile Picture
    Eugen Glasow 6,355 on at
    RE: CoC with method whose signature includes default values

    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.

  • Ludwig Reinhard Profile Picture
    Ludwig Reinhard Microsoft Employee on at
    RE: CoC with method whose signature includes default values

    Hi,

    Can you please elaborat what you try to achieve and write the complete text of your abbreviation at least once?

    Many thanks,

    Ludwig

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: CoC with method whose signature includes default values

    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.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,605 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans