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?