Tuesday, February 24, 2026

Code to update Acutal sales tax amount of a salesline in D365F&O X++

public static void main(Args _args)

{

   SalesTable      salesTable = SalesTable::find("000811");

   TaxRegulation   taxRegulation;

   taxRegulation = TaxRegulation::newTaxRegulation(

   SalesTotals::getTax(salesTable),

   null,

   tableNum(SalesLine),

   68719862322); //salesline recid

   if(taxRegulation)

  {

       taxRegulation.allocateAmount(10);

       taxRegulation.saveTaxRegulation();

   }      

}

Output :


SalesLine :


Inoviced line with reflected tax amount :







No comments:

Post a Comment