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 :
Small and medium business | Business Central, N...
Suggested Answer

How to apply sales tax amount fetched from an external API to Sales Order Lines using AL Language

(1) ShareShare
ReportReport
Posted on by 7
Hello all,
Thanks in advance.
I am customizing Business Central. I have stuck on a point that I do not want to use BC internal sales tax engine. I am fetching sales tax amount from some external API and now I want to apply this sales tax amount on the lines of sales order. Is it possible by using AL programing or not. If yes how we can perform that.
 
Thanks  
I have the same question (1)
  • Greg Kujawa Profile Picture
    787 on at
    We too have run into this challenge. A custom AL extension could accomplish this, but it can get rather complicated. Since there are numerous event triggers that occur when it comes to sales tax being hit. If you search this forum you will see similar posts. There is apparently a free Microsoft extension called Tax Engine that allows for business logic to be defined for specific use cases. Flexibly enough to handle most needs. But it's India-only, so I can't try it out in our US SaaS tenant. And the third party solutions such as Avalara and Vertex seem to be cost-prohibitive.
  • Suggested answer
    Greg Kujawa Profile Picture
    787 on at
    When it comes to our use case, we have a retail location in Tennessee. And that state collects single article sales tax against specific sale line items that fall within a certain dollar threshold. Out of the box BC 365 couldn't handle this. And we thought that the ISV solutions were cost-prohibitive. Since we are primarily looking at just Sales Orders and Sales Invoices, I believe that I have deployed an AL extension codeunit that handles this properly. Conditionally just for any Sales Line items that are associated with our one Tennessee location code.
     
    The two event subscribers I attached to were:
     
    • Database::"Sales Line", 'OnAfterSalesTaxCalculate'
    • Codeunit::"Sales Tax Calculate", 'OnBeforeApplyTaxDifference'

    Testing out some transactions all initially appears to be working fine. Of course it will take more testing and working through many scenarios. This codeunit manually calculates sales tax, and doesn't make an external third-party API call. When it comes to BC 365 SaaS at least, I'm not positive if that's doable or not. When we tested out BC 365 on-prem last year I know I was able to compile my own .NET assemblies and call them to perform actions such as that. I believe that SaaS doesn't allow compiled .NET assemblies to be added, and I can't recall if you can create a REST API client in AL code to call out to a third-party external API endpoint.    

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,993 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,116 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 557 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans