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

AL Code for Integration between Business Central and External Sales System via API

(4) ShareShare
ReportReport
Posted on by 12
Hello,
 
I'm looking for some guidance on how to write AL code in Visual Studio Code to establish a continuous integration between Microsoft Dynamics 365 Business Central and an external sales system via API.
 
Specifically, I want to achieve the following:
Retrieve customers and sales invoices created in the external sales system and import them into Business Central.
Continuously synchronize item details from Business Central to the external sales system.

Most examples I've come across online demonstrate integration using Postman, but I'm specifically interested in implementing this functionality using AL code in Visual Studio Code.
 
I would greatly appreciate any advice, tips, or resources that can help me accomplish this task efficiently.
 
Thank you in advance for your assistance!
I have the same question (0)
  • Suggested answer
    Gerardo Rentería García Profile Picture
    25,213 Most Valuable Professional on at
    Hi
    I hope this can help you. And give you some hints. Extending standard APIs (2) – Kauffmann @ Dynamics 365 Business Central
    BR
    GR
  • Lama Khaled Profile Picture
    12 on at
    Hi,
    Thanks, gdrenteria for your reply but I need the basic steps to start creating AL code for the connection between BC and the second system, the URL for the document you sent has a complicated way that isn't useful for me because I'm a beginner can you advise?
  • Suggested answer
    YUN ZHU Profile Picture
    95,331 Super User 2025 Season 2 on at
    Hi, you can search for the "HttpClient data type" keyword and you should be able to find a lot of learning materials.
    For example,
    Call external services with the HttpClient data type
     
     
    Hope this helps.
    Thanks.
    ZHU
  • Lama Khaled Profile Picture
    12 on at
     
    Hi Mrs,
     
    Thanks for your advice on using HTTP data type, I searched and found about this but I need to use AuthO type to use secret ID and token, and how I make an integration between an Outside system with Business Central to get and post data between them, how I can apply the mapping between them, I need example code if you can ? I apprsieated your effort but I need someone to give me the light of the road in this matter because I am a beginner and first time I will do that 
  • CU16041327-0 Profile Picture
    12 on at
    @Lama Khaled Where you able to do the integration? Because I'm also a beginner and i want to learn.
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    20,347 Super User 2025 Season 2 on at
  • Suggested answer
    Jainam M. Kothari Profile Picture
    15,631 Super User 2025 Season 2 on at
  • Matteo Fiocco Profile Picture
    260 on at

    Hi Lama,

     

    You can achieve this using AL with HttpClient and scheduled Codeunits. For importing customers and sales invoices, create a Codeunit that makes GET requests to the external API and maps the JSON response to BC records. For item sync, use a similar Codeunit with POST/PUT requests to push updates.

     

    Set up Job Queue Entries to run these Codeunits on a schedule for continuous sync. Make sure to handle auth (e.g., Bearer token) via request headers.

     

    Let me know if you need a sample structure!

     

    Cheers,

    Matteo

  • Gerardo Rentería García Profile Picture
    25,213 Most Valuable Professional on at

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