web
You’re offline. This is a read only version of the page.
close
Skip to main content
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)
  • Gerardo Rentería García Profile Picture
    23,145 Most Valuable Professional on at
    AL Code for Integration between Business Central and External Sales System via API
  • Matteo Fiocco Profile Picture
    258 on at
    AL Code for Integration between Business Central and External Sales System via API

    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

  • Suggested answer
    Jainam M. Kothari Profile Picture
    12,116 Super User 2025 Season 2 on at
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    19,085 Super User 2025 Season 2 on at
    AL Code for Integration between Business Central and External Sales System via API
  • CU16041327-0 Profile Picture
    12 on at
    AL Code for Integration between Business Central and External Sales System via API
    @Lama Khaled Where you able to do the integration? Because I'm also a beginner and i want to learn.
  • Lama Khaled Profile Picture
    12 on at
    AL Code for Integration between Business Central and External Sales System via API
     
    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 
  • Suggested answer
    YUN ZHU Profile Picture
    90,632 Super User 2025 Season 2 on at
    AL Code for Integration between Business Central and External Sales System via API
    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
    AL Code for Integration between Business Central and External Sales System via API
    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
    Gerardo Rentería García Profile Picture
    23,145 Most Valuable Professional on at
    AL Code for Integration between Business Central and External Sales System via API
    Hi
    I hope this can help you. And give you some hints. Extending standard APIs (2) – Kauffmann @ Dynamics 365 Business Central
    BR
    GR

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

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

#1
Sumit Singh Profile Picture

Sumit Singh 2,857

#2
Sohail Ahmed Profile Picture

Sohail Ahmed 2,687 Super User 2025 Season 2

#3
Jeffrey Bulanadi Profile Picture

Jeffrey Bulanadi 2,203

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans