Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Override sales tax on each sales order line through X++ code

(0) ShareShare
ReportReport
Posted on by 2,474

Hello experts,

I have a requirement to override the sales tax for each sales line while sales invoice posting.

can someone please help?

  • Pavel Vorontsov Profile Picture
    20 on at
    RE: Override sales tax on each sales order line through X++ code

    I had similar requirements - POS receipt lines were calculated line by line, and rounded tax from each small quantity, but it was sent to tax authorities and resulting AX sales invoice didnt match, because it was created for summary amount and summary tax. To solve this I created class something like TaxRetail, which created tmpTaxWorkTrans in calc method based on data from RetailStatement table. Tables name are not exact, but anyway - the idea is to create class which is inherited from tax - and create your own calculation.

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,091 on at
    RE: Override sales tax on each sales order line through X++ code

    Hi Mohammad,

    I'm not sure if you can adjust taxes for each line independently, but you can adjust taxes for the whole order.

    Check TaxRegulation::adjustTaxInvoice method, it's used when credit note is created and tax is adjusted from original invoice. You can probably develop something similar.

  • Mohammad Raziq Ali Profile Picture
    2,474 on at
    RE: Override sales tax on each sales order line through X++ code

    Hello Will WU,

    thanks for providing the link.

    This is not of much help as my requirement at the time of sales invoice.

    This link does show which object to modify but I need a place where should I write the code.

    Regards,

    Raziq

  • WillWU Profile Picture
    22,352 on at
    RE: Override sales tax on each sales order line through X++ code

    Hi Mohammad,

    Please see the updateTaxRegulationAmount method in the class TaxRegulationDetail .

    And have a look at this old thread:

    community.dynamics.com/.../sales-tax-override-on-pending-vendor-invoice-lines

  • Mohammad Raziq Ali Profile Picture
    2,474 on at
    RE: Override sales tax on each sales order line through X++ code

    No, the problem here is the transaction coming from POS does not have a sales tax code and the sales amount must be overridden with the existing sales tax amount.

  • Suggested answer
    nmaenpaa Profile Picture
    101,158 Moderator on at
    RE: Override sales tax on each sales order line through X++ code

    Perhaps the easiest solution (which would also not require customization of tax calculation) would be to let D365 calculate the same tax for you by setting up the tax setup correctly. Your integration needs to simply tell which tax code applies to each sales line, and whether tax is included in the price or not.

    Wouldn't this produce the outcome that you need?

  • Mohammad Raziq Ali Profile Picture
    2,474 on at
    RE: Override sales tax on each sales order line through X++ code

    Thanks for the reply Nikolaos,

    Sales tax amount value coming from POS which I am saving on sales line through extension and this sales tax must be considered/overridden with the existing sales tax amount (through sales tax code on each sales line) while posting retail statement which then creates a sales order and invoices it.

    I have sales tax amount ready on each line. I just need code and place to write the code.

    Best regards,

    Raziq.

  • nmaenpaa Profile Picture
    101,158 Moderator on at
    RE: Override sales tax on each sales order line through X++ code

    What exactly do you mean by "overriding sales tax"? Could you share your actual business requirement?

    You can impact the tax calculation with tax setup.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,233 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,982 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans