Importing Sales Invoices into Dynamics 365 Business Central
This task will create or update sales invoices in Dynamics 365 Business Central. The data must be supplied in the Dynamics 365 Business Central Sales Invoice XML format.
Sales invoices are matched based on the following XML elements, in the order listed: Id
, ExternalId
, Number
, ExternalDocumentNumber
. If a match is found, the existing sales invoice will be updated. If not, a new sales invoice will be created.
When updating existing sales invoices, the sales 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 sales invoice line will be updated. If not, a new sales 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 Customers
Required
Set to true to have the task automatically create new customers if they do not already exist, and have been provided within the Customer
or BillToCustomer
element of the XML. Setting this to false will cause the record to fail import if the customers do not already exist.
Note
The CustomerId
, CustomerNumber
, BillToCustomerId
and BillToCustomerNumber
elements take precedence over data provided in the Customer
and BillToCustomer
elements. They should not be specified if you want to auto create customers.
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 Post
Required
Set to true to have the task automatically post each record.
Auto Send
Required
Set to true to have the task automatically send each record.
Match Customers On
Optional
The list of fields to use to try and find an existing customer in Dynamics 365 Business Central which matches with the customer in the input file. These settings will only be used if the customer 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 customers 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 Sales Invoice XML:
<?xml version="1.0" encoding="utf-8"?>
<SalesInvoices xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SalesInvoice>
<Id>80230bc9-ccbc-ed11-9a88-002248002e07</Id>
<ExternalId>54321</ExternalId>
<Number>103215</Number>
<ExternalDocumentNumber>TEST-0001</ExternalDocumentNumber>
<InvoiceDate>2023-03-07T00:00:00</InvoiceDate>
<DueDate>2023-04-01T00:00:00</DueDate>
<CustomerPurchaseOrderReference>PO-124124</CustomerPurchaseOrderReference>
<CustomerId>d4f4fd40-34bc-ed11-9a88-6045bd0cf992</CustomerId>
<CustomerNumber>C00020</CustomerNumber>
<Customer>
<ExternalId>5230</ExternalId>
<Number>C00020</Number>
<DisplayName>Zynk Software</DisplayName>
<Type>Company</Type>
<AddressLine1>Office 16</AddressLine1>
<AddressLine2>6 Charlotte Square</AddressLine2>
<City>Newcastle</City>
<State>Tyne & Wear</State>
<Country>GB</Country>
<PostalCode>NE1 4XF</PostalCode>
<PhoneNumber>0191 303 2920</PhoneNumber>
<Email>[email protected]</Email>
<Website>www.zynk.com</Website>
<TaxLiable>false</TaxLiable>
<TaxAreaId>0015deb9-611d-ea11-bb2d-000d3a4884fc</TaxAreaId>
<TaxAreaDisplayName>Domestic customers and vendors</TaxAreaDisplayName>
<TaxRegistrationNumber>GB111111111</TaxRegistrationNumber>
<CurrencyId>00000000-0000-0000-0000-000000000000</CurrencyId>
<CurrencyCode>GBP</CurrencyCode>
<PaymentTermsId>f997d7da-549e-ed11-988a-000d3a3885d3</PaymentTermsId>
<ShipmentMethodId>ae98d7da-549e-ed11-988a-000d3a3885d3</ShipmentMethodId>
<PaymentMethodId>c48d3bdf-549e-ed11-988a-000d3a3885d3</PaymentMethodId>
<Blocked> </Blocked>
</Customer>
<BillToCustomerId>d4f4fd40-34bc-ed11-9a88-6045bd0cf992</BillToCustomerId>
<BillToCustomerNumber>C00020</BillToCustomerNumber>
<BillToCustomer>
<ExternalId>5230</ExternalId>
<Number>C00020</Number>
<DisplayName>Zynk Software</DisplayName>
<Type>Company</Type>
<AddressLine1>Office 16</AddressLine1>
<AddressLine2>6 Charlotte Square</AddressLine2>
<City>Newcastle</City>
<State>Tyne & Wear</State>
<Country>GB</Country>
<PostalCode>NE1 4XF</PostalCode>
<PhoneNumber>0191 303 2920</PhoneNumber>
<Email>[email protected]</Email>
<Website>www.zynk.com</Website>
<TaxLiable>false</TaxLiable>
<TaxAreaId>0015deb9-611d-ea11-bb2d-000d3a4884fc</TaxAreaId>
<TaxAreaDisplayName>Domestic customers and vendors</TaxAreaDisplayName>
<TaxRegistrationNumber>GB111111111</TaxRegistrationNumber>
<CurrencyId>00000000-0000-0000-0000-000000000000</CurrencyId>
<CurrencyCode>GBP</CurrencyCode>
<PaymentTermsId>f997d7da-549e-ed11-988a-000d3a3885d3</PaymentTermsId>
<ShipmentMethodId>ae98d7da-549e-ed11-988a-000d3a3885d3</ShipmentMethodId>
<PaymentMethodId>c48d3bdf-549e-ed11-988a-000d3a3885d3</PaymentMethodId>
<Blocked> </Blocked>
</BillToCustomer>
<SellToAddressLine1>6 Charlotte Square</SellToAddressLine1>
<SellToCity>Newcastle Upon Tyne</SellToCity>
<SellToState>Tyne & Wear</SellToState>
<SellToCountry>GB</SellToCountry>
<SellToPostCode>NE1 4XF</SellToPostCode>
<ShipToName>Zynk Software</ShipToName>
<ShipToContact>John Smith</ShipToContact>
<ShipToAddressLine1>6 Charlotte Square</ShipToAddressLine1>
<ShipToCity>Newcastle Upon Tyne</ShipToCity>
<ShipToState>Tyne & Wear</ShipToState>
<ShipToCountry>GB</ShipToCountry>
<ShipToPostCode>NE1 4XF</ShipToPostCode>
<CurrencyId>00000000-0000-0000-0000-000000000000</CurrencyId>
<CurrencyCode>GBP</CurrencyCode>
<PaymentTermsId>ff97d7da-549e-ed11-988a-000d3a3885d3</PaymentTermsId>
<PaymentTerm>
<Code>30 DAYS</Code>
</PaymentTerm>
<ShipmentMethodId>b598d7da-549e-ed11-988a-000d3a3885d3</ShipmentMethodId>
<ShipmentMethod>
<Code>DELIVERY</Code>
</ShipmentMethod>
<Salesperson>JO</Salesperson>
<DiscountAmount>0</DiscountAmount>
<PhoneNumber>0191 820 1484</PhoneNumber>
<Email>[email protected]</Email>
<SalesInvoiceLines>
<SalesInvoiceLine>
<Id>a0505529-cdbc-ed11-9a88-002248002e07</Id>
<ExternalId>54321-1</ExternalId>
<Sequence>10000</Sequence>
<ItemId>2a99d7da-549e-ed11-988a-000d3a3885d3</ItemId>
<Item>
<ExternalId>1928-S</ExternalId>
<Number>1928-S</Number>
<DisplayName>AMSTERDAM Lamp</DisplayName>
<Type>Inventory</Type>
<ItemCategoryId>2b18deb9-611d-ea11-bb2d-000d3a4884fc</ItemCategoryId>
<ItemCategoryCode>MISC</ItemCategoryCode>
<Blocked>false</Blocked>
<Gtin />
<UnitPrice>35.6</UnitPrice>
<PriceIncludesTax>false</PriceIncludesTax>
<UnitCost>27.8</UnitCost>
<TaxGroupId>2c8e3bdf-549e-ed11-988a-000d3a3885d3</TaxGroupId>
<TaxGroupCode>STANDARD</TaxGroupCode>
<BaseUnitOfMeasureId>2d8c3bdf-549e-ed11-988a-000d3a3885d3</BaseUnitOfMeasureId>
<BaseUnitOfMeasureCode>PCS</BaseUnitOfMeasureCode>
</Item>
<AccountId>f9b2e6b3-611d-ea11-bb2d-000d3a4884fc</AccountId>
<Account>
<Id>f9b2e6b3-611d-ea11-bb2d-000d3a4884fc</Id>
<Number>10100</Number>
</Account>
<LineType>Item</LineType>
<LineObjectNumber>1928-S</LineObjectNumber>
<Description>AMSTERDAM Lamp</Description>
<UnitOfMeasureId>2d8c3bdf-549e-ed11-988a-000d3a3885d3</UnitOfMeasureId>
<UnitOfMeasureCode>PCS</UnitOfMeasureCode>
<UnitPrice>35.6</UnitPrice>
<Quantity>3</Quantity>
<DiscountAmount>0</DiscountAmount>
<DiscountPercent>0</DiscountPercent>
<TaxCode>STANDARD</TaxCode>
</SalesInvoiceLine>
</SalesInvoiceLines>
</SalesInvoice>
</SalesInvoices>