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 :
Finance | Project Operations, Human Resources, ...
Unanswered

How to update Actual Tax amount in Sales Order programmatically ?

(0) ShareShare
ReportReport
Posted on by 596
Hi all,
 
This is about Sales Order question, specifically on Actual tax amount. I'm trying to programmatically update actual tax amount during Sales Order creation which also create by code.
 
I'm using this part of code :
 
            SalesTotals salesTotals     = SalesTotals::construct(salesTable,SalesUpdate::All);
            salesTotals.calc();
                
            if (!CustParameters::find().EnableSingleLineTaxAdjustment)   // need this parameter activated
            {
                throw Error(/@TaxEnableSalesOrderSingleLineAdjustment:EnableSingleLineTaxAdjustment/);
            }
            TaxRegulationDetail taxRegulation = TaxRegulation::newTaxRegulation(salesTotals.tax());
            TaxRegulationDetail taxRegulationDetail = taxRegulation as TaxRegulationDetail;
            TmpTaxRegulation    tmpTaxRegulationDetail = taxRegulationDetail.tmpTaxRegulationDetail();
 
            select tmpTaxRegulationDetail
                where tmpTaxRegulationDetail.SourceRecId            == salesLine.RecId
                    && tmpTaxRegulationDetail.SourceTableId         == tableNum(SalesLine)
                    && tmpTaxRegulationDetail.TaxAdjustmentType     == TaxAdjustmentType::Detail
                    && tmpTaxRegulationDetail.OverrideCalculatedTax == NoYes::No;
            if (tmpTaxRegulationDetail && tmpTaxRegulationDetail.SourceRegulateAmountCur != <myActualTaxAmount> )
            {
                taxRegulation.updateTaxRegulationAmount(tmpTaxRegulationDetail, <myActualTaxAmount>, true);
                taxRegulation.saveTaxRegulation();
            }
 
My question now, does this Actual Tax Amount sign should follow the sign of the sales amount or not ?
Or is the amount should be the opposite sign of the sales amount ?
 
When posting invoice I have discrepancy which looking at the message it looks like it is because the sign is not correct, or even it is actually not reflected by the actual amount.
 
Thanks,
 
 
 
I have the same question (0)

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 512 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 386

#3
Adis Profile Picture

Adis 259 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans