Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Unanswered

Bound Action ..receiveAndInvoice returns error however is sucessful in recieve only scenario

(0) ShareShare
ReportReport
Posted on by 3
Consider a one line Purchase Order (id= xxxx )  with a quantity of 1 Item to purchase. 
On delivery of the Item I want to use the api to update the line with: 
invoiceQuantity =0 ( since Invoice not yet received)
recieveQuantity  =1 ( since the 1 ordered item was received). 
 
Next step is to post the reciept using the API bound action : 
https://{INSTANCE}/api/v2.0/companies(24e9e5bb-e146-ee11-be72-6045bdacc06d)/purchaseOrders({xxxx})/Microsoft.NAV.receiveAndInvoice
 
tested with powershell invoke- webrequest:
$caughtError=//
try {
Invoke-WebRequest -uri $uri -Method Post  -Credential $credential -Header $Headers
}
catch {
   $caughtError  = $_
The result is an error : 

Response status code does not indicate success:    
                        400 (You need to enter the document number of the document from the vendor in the Vendor Invoice No.    
                        field, so that this document stays linked to the original.).
 
Hoewever - the receipt has been posted to the purchase order and the order line is updated with the Quantity Recived + 1
(and Quantity to Invoice = Quantity Received - Quantity Invoiced)
 
I do not expect this error since it is not generated either when posting from the webclient. 
 
Any thoughts? 
  • Bound Action ..receiveAndInvoice returns error however is sucessful in recieve only scenario
    We have the same issue, but experience a different error message:
     
    "There is no Purch. Inv. Header within the filter.\r\n\r\nFilters: Order No.: INX1230012, Order No. Series: ''
     
    It seems like BC expects that there will always be an invoice, when building the response.
     
    I guess we will have to mitigate this error in the API, by enterpreting this specific error message as success.
     
     

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,661 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,379 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans