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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

An extension class using ExtensionOf attribute can not extend another extension class not using the ExtensionOf attribute

(0) ShareShare
ReportReport
Posted on by

Hello

How can I fix the following issue? Is it possible at all?

pastedimage1657711227634v1.png

LedgerJournalTrans_PL_Extension class is an original class from Application Suite.

D365 Version: Installed platform version : Update50 (7.0.6354.93)

I have the same question (0)
  • nunomaia Profile Picture
    25 Moderator on at

    You should extend base class and not the extension. What are you trying to get ?

  • Grzegorz Wawrzeniecki Profile Picture
    on at

    Thx for your reply!

    I am extending the base class.

    pastedimage1657712279755v1.png

    I don't know what the reason for naming it Extension is

    I want to extend with CoC one method from that class.

  • Verified answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    The reason why the class name is suffixed with _Extention is that the class contains extension methods. For example, the first method is called calcUserTaxBase_PL() and if you look at references, you'll find that it's called as if it was a method of LedgerJournalTrans table:

    ledgerJournalTrans.calcUserTaxBase_PL();

    These days, we use ExtensionOf attribute on a class and a simpler syntax to define extensin methods, but this is how it was done before ExtensionOf attribute was introduced - and it still can be used. But, as you see, extensions of these classes don't seem to be supported,

  • Grzegorz Wawrzeniecki Profile Picture
    on at

    Thx for your reply!

    Okay, now I finally understand it.

    Since the extension of these classes doesn't seem to be supported, is there any way to achieve my needs?

    I see that this extension method is called in LedgerJournalEngine class.

    pastedimage1657717683360v1.png

    But the parameter isn't passed to the method

  • Verified answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    That's correct - the parameter isn't passed to the method, because it's called as if it was an instance method of _ledgerJournalTrans. You write code

    _ledgerJournalTrans.initFromCustVendVatRegNums_PL()

    but the code generated by compiler is actually this:

     LedgerJournalTrans_PL_Extension::initFromCustVendVatRegNums_PL(_ledgerJournalTrans).

    The first parameter is used to identify the current object, which is actually done by the left part of this expression:

    _ledgerJournalTrans.initFromCustVendVatRegNums_PL()

    Therefore the first parameter isn't included in parameters that you can specify when calling the 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 551 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans