Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Unanswered

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

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.
     
     

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,277 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,126 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans