When inserting a new purhcase/sales invoice & line items, I noticed that the line items "itemId" property only recognises the id's from the "Item" table ant any other table such as "resources" or "Fixed Asset" etc, hence the message
The field Item Id of table Purch. Inv. Line Aggregate contains a value ({itemId}) that cannot be found in the related table (Item)
The current HTTTPOST endpoint I am pointing to is :
api/v1.0/companies(companyId)/purchaseInvoices?$expand=purchaseInvoiceLines
With an example body:
{
"vendorId": "vendorId",
"invoiceDate": "2018-02-02",
"dueDate": "2022-01-01",
"currencyCode": "JPY",
"purchaseInvoiceLines": [
{
"lineType": "Resource",
"itemId" : "Item Id that is a resource instead of type item",
"quantity": 2,
"discountAppliedBeforeTax": true,
"expectedReceiptDate": "2019-01-01"
}
]
}
- I would firstly like to know if there is any other information I am missing from this body that I would need to let the invoice line item know where to look, do I need to give the item id of the resource to a different property other than itemId?
- I would also like to know where (in the business central NAV extension world) does this endpoint live in? What table/page/codeunit should I be investigating?
- Thirdly, is there any other recommended endpoint I should be using in order to push to purchase/sales invoice & it's lineItems?