Importing Purchase Invoices into Dynamics 365 Business Central
This task will create or update purchase invoices in Dynamics 365 Business Central. The data must be supplied in the Dynamics 365 Business Central Purchase Invoice XML format.
Purchase invoices are matched based on the following XML elements, in the order listed: Id
, ExternalId
, Number
. If a match is found, the existing purchase invoice will be updated. If not, a new purchase invoice will be created.
When updating existing purchase invoices, the purchase invoice lines are matched based on the following XML elements, in the order listed: Id
, ExternalId
, Sequence
, ItemId
. If a match is found, the existing purchase invoice line will be updated. If not, a new purchase invoice line will be created.
Settings
Dynamics 365 Business Central Connection
Required
The connection to Dynamics 365 Business Central to use. See the Connecting to Dynamics 365 Business Central article if you require more information on how to create/manage connections.
Fail File
Required
The name of a file for records that fail to import to be output to. The data will be in the same XML format as the input file.
Input File
Required
The file containing the records that you want to import into Dynamics 365 Business Central. The records must be supplied in the XML format shown below.
Success File
Required
The name of a file for successfully imported records to be output to. The data will be in the same XML format as the input file.
Auto Create Items
Required
Set to true to have the task automatically create new items if they do not already exist, and have been provided within the Item
element of the XML. Setting this to false will cause the record to fail import if any of the items does not already exist.
Note
The LineObjectNumber
element takes precedence over data provided in the Item
element. It should not be specified if you want to auto create items.
Auto Create Vendors
Required
Set to true to have the task automatically create new vendors if they do not already exist, and have been provided within the Vendor
or PayToVendor
element of the XML. Setting this to false will cause the record to fail import if the vendors do not already exist.
Note
The VendorId
, VendorNumber
, PayToVendorId
and PayToVendorNumber
elements take precedence over data provided in the Vendor
and PayToVendor
elements. They should not be specified if you want to auto create vendors.
Auto Post
Required
Set to true to have the task automatically post each record.
Match Vendors On
Optional
The list of fields to use to try and find an existing vendor in Dynamics 365 Business Central which matches with the vendor in the input file. These settings will only be used if the vendor Id and Number are not provided in the input file, and the external ID is not found in the truth table. When multiple fields are selected, only vendors where the value of all the fields match will be considered a match. The following fields are supported:
- DisplayName
- PhoneNumber
Prevent Reprocessing
Required
Set this to 'True' to check the value specified in the ExternalId
element in the XML against the truth table to see if it has already been processed, and if so skip the record.
Zynk Settings
Examples
Sample input file, for full documentation see Dynamics 365 Business Central Purchase Invoice XML:
<?xml version="1.0" encoding="utf-8"?>
<PurchaseInvoices xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<PurchaseInvoice>
<Id>d3f919dc-39bc-ed11-9a88-002248002e07</Id>
<Number>107212</Number>
<InvoiceDate>2020-03-13T00:00:00</InvoiceDate>
<DueDate>2020-03-30T00:00:00</DueDate>
<VendorInvoiceNumber>TEST-002</VendorInvoiceNumber>
<VendorId>4d4971d5-39bc-ed11-9a88-002248002e07</VendorId>
<VendorNumber>V00010</VendorNumber>
<Vendor>
<ExternalId>8888</ExternalId>
<Number>V00010</Number>
<DisplayName>Zynk Software</DisplayName>
<AddressLine1>6 Charlotte Square</AddressLine1>
<AddressLine2></AddressLine2>
<City>Newcastle Upon Type</City>
<State>Tyne & Wear</State>
<Country>GB</Country>
<PostCode>NE1 4XF</PostCode>
<PhoneNumber />
<Email>[email protected]</Email>
<Website>www.zynk.com</Website>
<TaxRegistrationNumber>GB123456789</TaxRegistrationNumber>
<CurrencyId>00000000-0000-0000-0000-000000000000</CurrencyId>
<CurrencyCode>GBP</CurrencyCode>
<Irs1099Code />
<PaymentTermsId>0298d7da-549e-ed11-988a-000d3a3885d3</PaymentTermsId>
<PaymentMethodId>c58d3bdf-549e-ed11-988a-000d3a3885d3</PaymentMethodId>
<TaxLiable>true</TaxLiable>
<Blocked> </Blocked>
</Vendor>
<PayToVendorId>4d4971d5-39bc-ed11-9a88-002248002e07</PayToVendorId>
<PayToVendorNumber>V00010</PayToVendorNumber>
<PayToVendor>
<ExternalId>8888</ExternalId>
<Number>V00010</Number>
<DisplayName>Zynk Software</DisplayName>
<AddressLine1>6 Charlotte Square</AddressLine1>
<AddressLine2></AddressLine2>
<City>Newcastle Upon Type</City>
<State>Tyne & Wear</State>
<Country>GB</Country>
<PostalCode>NE1 4XF</PostalCode>
<PhoneNumber />
<Email>[email protected]</Email>
<Website>www.zynk.com</Website>
<TaxRegistrationNumber>GB123456789</TaxRegistrationNumber>
<CurrencyId>00000000-0000-0000-0000-000000000000</CurrencyId>
<CurrencyCode>GBP</CurrencyCode>
<Irs1099Code />
<PaymentTermsId>0298d7da-549e-ed11-988a-000d3a3885d3</PaymentTermsId>
<PaymentMethodId>c58d3bdf-549e-ed11-988a-000d3a3885d3</PaymentMethodId>
<TaxLiable>true</TaxLiable>
<Blocked> </Blocked>
</PayToVendor>
<ShipToName>John Smith</ShipToName>
<ShipToContact>John Smith</ShipToContact>
<ShipToAddressLine1>6 Charlotte Square</ShipToAddressLine1>
<ShipToAddressLine2></ShipToAddressLine2>
<ShipToCity>Newcastle Upon Type</ShipToCity>
<ShipToState>Tyne & Wear</ShipToState>
<ShipToCountry>GB</ShipToCountry>
<ShipToPostCode>NE1 4XF</ShipToPostCode>
<BuyFromAddressLine1>6 Charlotte Square</BuyFromAddressLine1>
<BuyFromAddressLine2></BuyFromAddressLine2>
<BuyFromCity>Newcastle Upon Type</BuyFromCity>
<BuyFromState>Tyne & Wear</BuyFromState>
<BuyFromCountryLetterCode>GB</BuyFromCountryLetterCode>
<BuyFromPostCode>NE1 4XF</BuyFromPostCode>
<CurrencyId>00000000-0000-0000-0000-000000000000</CurrencyId>
<CurrencyCode>GBP</CurrencyCode>
<DiscountAmount>0</DiscountAmount>
<PurchaseInvoiceLines>
<PurchaseInvoiceLine>
<Id>32866e76-3cbc-ed11-9a88-0022481af7c4</Id>
<Sequence>10000</Sequence>
<ItemId>2499d7da-549e-ed11-988a-000d3a3885d3</ItemId>
<Item>
<Number>1896-S</Number>
<DisplayName>ATHENS Desk</DisplayName>
</Item>
<AccountId>00000000-0000-0000-0000-000000000000</AccountId>
<Account>
<Number>10000</Number>
</Account>
<LineType>Item</LineType>
<LineObjectNumber>1896-S</LineObjectNumber>
<Description>ATHENS Desk</Description>
<UnitOfMeasureId>2d8c3bdf-549e-ed11-988a-000d3a3885d3</UnitOfMeasureId>
<UnitOfMeasureCode>PCS</UnitOfMeasureCode>
<UnitCost>506.6</UnitCost>
<Quantity>4</Quantity>
<DiscountAmount>0</DiscountAmount>
<DiscountPercent>0</DiscountPercent>
<TaxCode>STANDARD</TaxCode>
<ExpectedReceiptDate>2023-04-01T00:00:00</ExpectedReceiptDate>
</PurchaseInvoiceLine>
</PurchaseInvoiceLines>
</PurchaseInvoice>
</PurchaseInvoices>