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...
Answered

How to call third party API when "post" action in the Sales Order in Dynamics 365 Business Central

(0) ShareShare
ReportReport
Posted on by 44

Hello, I'm new to Dynamics 365 and I have a requirement to integrate a third-party system into Dynamics 365 Business Central.

We need to call third-party API when the "Post" action performed in the Sales Order screen by the user in Dynamics 365 Business Central. 

Anybody has worked on calling API from D365 Business Central,  please give some inputs on how to achieve this.

Appreciate any help!

Thanks!

I have the same question (0)
  • Verified answer
    Suresh Kulla Profile Picture
    50,237 Super User 2025 Season 2 on at
    RE: How to call third party API when "post" action in the Sales Order in Dynamics 365 Business Central

    I have done several integrations to third party API, you can use HttpClient to send the request, below is a simple example 

    RequestHeaders := HttpClient.DefaultRequestHeaders();
    RequestHeaders.Add('Authorization', ''); // Add the authorization based on the API
    RequestMessage.SetRequestUri(ApiURl));
    RequestMessage.Content.WriteFrom(CreateJsonRequest());
    RequestMessage.Method('POST');
    IsSuccessful := HttpClient.Send(RequestMessage, ResponseMessage);
    
    CreateJsonRequest is a method which creates a Json and returns the JsonText.

  • Suggested answer
    JAngle Profile Picture
    125 on at
    RE: How to call third party API when "post" action in the Sales Order in Dynamics 365 Business Central

    Adding to the answer from Suresh.

    You can use a codeunit to create an event subscriber to the Sales Post codeunit. This will enable you to make the HTTP call as Suresh has suggested at the right point in the posting sequence

  • Suggested answer
    Vijay Jupudi Profile Picture
    44 on at
    RE: How to call third party API when "post" action in the Sales Order in Dynamics 365 Business Central

    Thank you Josh for a detailed explanation.

        How to publish the new codeunit to Client Business Central Instance either through AppSource or another way to do that?

    Please provide any reference docs or links to me & will walk through it.

  • Verified answer
    JAngle Profile Picture
    125 on at
    RE: How to call third party API when "post" action in the Sales Order in Dynamics 365 Business Central

    Appsource explanation is much more long winded. Once you have it working I’d look at that as a completely separate learning exercise. Try this for now: community.dynamics.com/.../how-to-install-an-extension-created-from-the-sandbox

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

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

#1
Sumit Singh Profile Picture

Sumit Singh 2,163

#2
OussamaSabbouh Profile Picture

OussamaSabbouh 1,908

#3
YUN ZHU Profile Picture

YUN ZHU 1,878 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans