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,
 
 
 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 274 Super User 2026 Season 2

#2
Aayush Tiwari Profile Picture

Aayush Tiwari 213

#3
Subra Profile Picture

Subra 202 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans