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, ...
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

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 660 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 307 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans