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 :
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 (0)
  • Greg Kujawa Profile Picture
    583 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
    583 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

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 > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,143

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans