Skip to main content
Community site session details

Community site session details

Session Id :
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? 
  • Community member Profile Picture
    2 on at
    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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,655

#2
Mansi Soni Profile Picture

Mansi Soni 1,574

#3
YUN ZHU Profile Picture

YUN ZHU 1,453 Super User 2025 Season 1

Featured topics

Product updates

Dynamics 365 release plans