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

Azure Function call

(0) ShareShare
ReportReport
Posted on by 1,638

Hello Experts,

I am just consuming an azure function URL and in return giving them the purchase order number:-

In my debugger, I am receiving an HTTP status code 500 error , don't know why 

pastedimage1648023348864v1.pngpastedimage1648658065916v1.png

Em I missing something here ??

Thanks,

TK

I have the same question (0)
  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,161 Moderator on at

    Http status message 500 is internal server error. That should indicate that the problem is within the azure function and not really in your Business Central code.

    Here are some code i use for calling an azure function. I could see some differences around content and http headers

    procedure SendToAzure(Payload: text): Boolean;

       var

           Setup: Record Azuresetup;

           hclient: HttpClient;

           respons: HttpResponseMessage;

           Content: HttpContent;

           ContentHeaders: HttpHeaders;

       begin

           if not AzureSetup.FindFirst() then error('%1 is empty', AzureSetup.TableCaption);

           AzureSetup.TestField("Outgoing file url");

           Content.WriteFrom(Payload);

           Content.GetHeaders(ContentHeaders);

           ContentHeaders.Clear();

           ContentHeaders.Add('Content-Type', 'application/json');

           hclient.Post(BankSetup."Outgoing file url", Content, respons);

           if respons.IsSuccessStatusCode then begin

               exit(true);

           end else begin

               Message(format(respons.HttpStatusCode));

               exit(false);

           end;

       end;

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,091 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,032 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 946 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans