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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Extending SalesInvoiceDP class.

(0) ShareShare
ReportReport
Posted on by 6,480

Hello,

I have to add some new fields to tmp tables used in salesInvoiceDP class.

I wanted to assign values to new fields in newly created _Extension class of SalesInvoiceDP and wanted to use Chain of Command.

I wanted to modify "insertIntoSalesInvoiceHeaderFooterTmp" method with CoC, but it gave me error as insertIntoSalesInvoiceHeaderFooterTmp is a private method and can't be used within Coc.

Then I tried to copy pre event handler of that method, but I got an error:

"Pre or post event handlers can only be created on hookable methods. Hookable methods are non-abstract methods that are either public or have been attributed with Hookable(true)."

What would be a best option to correctly fill new fields in DP classes? In this case SalesInvoiceDP, insertIntoSalesInvoiceHeaderFooterTmp method?

Thanks.

*This post is locked for comments

I have the same question (0)
  • Johnny Profile Picture
    6,480 on at

    Update:

    I'm going to use CoC on "insertInvoiceHeaderInformation" method, which calls "insertIntoSalesInvoiceHeaderFooterTmp".

    My method looks as below:

    public void insertInvoiceHeaderInformation(CustInvoiceJour _custInvoiceJour, CompanyInfo _companyInfo)
    {
        this.salesInvoiceHeaderFooterTmp.xxxPaymTermsDays = PaymTerm::find(_custInvoiceJour.Payment).NumOfDays;
    
        next insertInvoiceHeaderInformation(_custInvoiceJour, _companyInfo);
    }
    Here I'm getting compiler error: Invalid token '='.
    xxxPaymTermsDays, which is new field added to salesInvoiceHeaderFooterTmp extension table is same edt as NumOfDays.

    What am I doing wrong here?
    Thanks.

  • AXDeveloperJunior Profile Picture
    100 on at

    I have the same problem. Have you found a solution?

  • Community Member Profile Picture
    on at

    What was the solution for this?

  • Suggested answer
    Anton Venter Profile Picture
    20,676 Super User 2026 Season 1 on at

    The Invalid token '='. compile error occurs in Visual Studio when the table field of the extended class is assigned directly:

        public void insertInvoiceHeaderInformation(CustInvoiceJour _custInvoiceJour, CompanyInfo _companyInfo)
        {
            this.salesInvoiceHeaderFooterTmp.BuyerName = 'The buyer name'; // < Invalid token '='
    
            next insertInvoiceHeaderInformation(_custInvoiceJour, _companyInfo);
        }

    However, there is no compile error when the assignment is done using a local variable of the temporary table:

        public void insertInvoiceHeaderInformation(CustInvoiceJour _custInvoiceJour, CompanyInfo _companyInfo)
        {
            SalesInvoiceHeaderFooterTmp salesInvoiceHeaderFooterTmpLocal = this.salesInvoiceHeaderFooterTmp;
    
            salesInvoiceHeaderFooterTmpLocal.BuyerName = 'The buyer name';
    
            next insertInvoiceHeaderInformation(_custInvoiceJour, _companyInfo);
        }

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Basit Profile Picture

Basit 1

#1
GL-01081504-0 Profile Picture

GL-01081504-0 1

#1
Roya Profile Picture

Roya 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans