Create Invoice |
Scroll |
In this step, the purchase invoice with all line items is created in Business Central. The invoice is not posted. It can be found under Purchasing -> Purchase invoices, from where it can be posted.
Method: POST
Endpoint: https://api.businesscentral.dynamics.com/v2.0/<environment name>/sandbox/api/v2.0/companies(<company id>)/purchaseInvoices
Body Mapping:
JSON Name |
JSON Value |
Type |
invoiceDate |
invDate |
Value |
vendorNumber |
IndexData.GetField("Vendor_No") |
Value |
vendorInvoiceNumber |
IndexData.GetField("Vendor_Invoice_No") |
Value |
purchaseInvoiceLines |
TWFm128 |
Object |
itemId |
IndexData.GetField("Item_Id") |
Value |
quantity |
IndexData.GetField("Quantity") |
Value |
unitCost |
IndexData.GetField("ItemPrice") |
Value |
lineType |
"item" |
Value |
This script extracts the invoice number from the response and saves it in the index data.