Friday 14 August 2020

Issue on Avalara Sales tax calculation in D365 FO

 Hi Techies,

This post is related to issue on Avalara sales tax calculation. 

Scenario: You are good with sales tax calculation while creating sales order manually. The reason, Avalara tax engine is been triggered on SalesTable_OnWrite() event through SalesTable form.

Issue: If you are importing sales orders through data entities or through interface, in that case SalesTable insert event is been triggered and you will see Avalara sales tax has not been calculated for those sales orders. Here is a fix:  

You can copy the Avalara code that is part of the Write method and use it in the Insert method/event - 

The code –


AVA_TaxEngine    ava_TaxEngine = new AVA_TaxEngine();

if (AVA_TaxEngine::isAvaTaxConfigurationEnabled() &&  !Ava_Configuration::find().DisableTaxCalculation)

        {

            ava_TaxEngine.GetTax(_salesTable,

                DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone()),

                                 false,

                                 null,

                                 AVA_DocumentType::SalesOrder,

                                 '',

                                 _salesTable.SalesType == SalesType::ReturnItem ?                 AVA_ConnSource::ReturnOrder : AVA_ConnSource::SalesOrder );

}

You need to pass the right parameters with the method.


Happy DAXing...