Announcements
Hi!
I would like to know if there is a way to trigger the Posting -> Post -> Ship action (no invoice) for Sales Order using the OData Web Services, SOAP Web Services or API Endpoints
I already saw this bound actions but i would like to make the same without the invoice stuff.
King regards!
Please go through the link and try to understand the process.
Thanks for the link. But I am not able to understand anything.
Please go through the below link:
I tried the following:
api.businesscentral.dynamics.com/.../Microsoft.NAV.shipAndInvoice
where e75cee00-b718-ed11-90eb-000d3a54b3bc is my salesorder id and the request body is
{
"number": "S-ORD101011"
}
Response is:
{
"error": {
"code": "BadRequest",
"message": "One or more errors occurred. CorrelationId: 2a39d66e-3719-4980-be0c-cfcb326dc36c."
}
}
Is there anything wrong?
You have to supply sales order no. filter within your api to perform the Ship and invoice action.
Thanks.
Hi there,
Could you please help me with the request body for the API call
api.businesscentral.dynamics.com/.../Microsoft.NAV.shipAndInvoice
Currently I am not supplying anything and it says
Awesome ...Not a lot of info out there on APIs and some are not there to start with like AP credits...good thing is you can create bound actions or unbound. If performance is key unbound is recommended
Finally I solved my problem,
First of all, I follow this guide to configure AL environment in Visual Studio Code
docs.microsoft.com/.../devenv-get-started
Then, downloaded this github repo
github.com/.../ALAppExtensions
In the APIV2SalesOrders.Page.al file, I found shipAndInvoice procedure, so I modified it as Samantha said and added the new code to my custom page.
Then I published as a Web Service and now Im able to trigger this actions using OdataV4
Hope it helps for someone with same needed.
Kind regards!
Hello Samantha,
Thanks for answering.
Where did u get that code from?
You can copy existing API and create your own. In the new API, comment out below code and create new procedure or rename existing to something like shipOnly(not a requirement just best practise):
local procedure PostWithShipAndInvoice(var SalesHeader: Record "Sales Header"; var SalesInvoiceHeader: Record "Sales Invoice Header")
var
DummyO365SalesDocument: Record "O365 Sales Document";
LinesInstructionMgt: Codeunit "Lines Instruction Mgt.";
O365SendResendInvoice: Codeunit "O365 Send + Resend Invoice";
OrderNo: Code[20];
OrderNoSeries: Code[20];
begin
O365SendResendInvoice.CheckDocumentIfNoItemsExists(SalesHeader, false, DummyO365SalesDocument);
LinesInstructionMgt.SalesCheckAllLinesHaveQuantityAssigned(SalesHeader);
OrderNo := SalesHeader."No.";
OrderNoSeries := SalesHeader."No. Series";
SalesHeader.Ship := true;
//SalesHeader.Invoice := true;//
SalesHeader.SendToPosting(Codeunit::"Sales-Post");
SalesInvoiceHeader.SetCurrentKey("Order No.");
SalesInvoiceHeader.SetRange("Pre-Assigned No. Series", '');
SalesInvoiceHeader.SetRange("Order No. Series", OrderNoSeries);
SalesInvoiceHeader.SetRange("Order No.", OrderNo);
SalesInvoiceHeader.FindFirst();
end;
Note: You also need to change few other bits since API looking for created invoice number so find that code but above works as is though u get a error response but order is shiped
/salesOrders(4bac2cec-1821-ec11-8f46-00224810896b)/Microsoft.NAV.shipOnly
André Arnaud de Cal...
294,000
Super User 2025 Season 1
Martin Dráb
232,850
Most Valuable Professional
nmaenpaa
101,158
Moderator