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

Bound action on custom API - getting BadRequest_NotFound

(1) ShareShare
ReportReport
Posted on by 9
Hi, I hope this question has not been answered before as I have searched and read my eyes dry for information.

I have a page, Pagetype = API, and i want to call the procedure Test which i have given the [ServiceEnabled
attribute.
The EntitySetName is 'customers'.

I am using this link format and i have been trying with GET and POST but it doesn't make a difference.

https://api.businesscentral.dynamics.com/v2.0/tenant/Sandbox/api/APIPublisher/APIGroup/APIVersion/companies(GUID)/customers(GUID)/Nav.Test


I have looked into the Microsoft V2 API source, example Page 30037 APIV2 - Sales Quotes where the MakeOrder service is exposed and that works fine.

By mentioning that, my problem is that i want to make an order from a quote, but i also want to have the new order number returned but i only get an empty 204 response.

Looking into the native makeOrder API, this is the last code that is executed:

ActionContext.AddEntityKey(FieldNo(Id), SalesHeader.SystemId);
ActionContext.SetResultCode(WebServiceActionResultCode::Deleted);


Our sandbox environment is on version 19 .

Thank you for your time and help

Kindly
Andreas
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    95,391 Super User 2025 Season 2 on at

    Hi, I recently added a new Action to Power Automate, hope this will give you some inspiration.

    https://yzhums.com/20111/

    Thanks.

    ZHU

  • Suggested answer
    Wishdale Profile Picture
    9 on at

    I resolved it

    Apparently the bound action is renamed with initial lowercasing, MyProcedure becomes myProcedure (Look it up with $metadata#).

    And the procedure, when called, needs to be prepended with Microsoft.NAV, eg: Microsoft.NAV.myFunction

    Also if you want return values, only primitives seems to be allowed and you can't use the standard procedure pattern;
    "procedure MyProcedure(var ActionContext: WebServiceActionContext)", as the procedure will not be made available if one gives it a return value.

    One needs to give it 0 or more parameters like
    procedure MyProcedure(myParameter: Text): Decimal
    var
        ActionContext: WebServiceActionContext
    begin
     exit(0);
    end;
  • Wishdale Profile Picture
    9 on at

    Thank you!

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 2,990

#2
Jainam M. Kothari Profile Picture

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

#3
YUN ZHU Profile Picture

YUN ZHU 1,028 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans