DynamicsNAV Connector - Customer Update
This document describes how customer data is synchronized from Dynamics NAV into the App4Sales platform. The process involves retrieving customer, address, and contact person information from Dynamics NAV, transforming it into the App4Sales internal data structure, and updating the App4Sales database. It also handles associated entities like customer notes, item class discounts, and customer dashboards.
Data Source Configuration
Customer data is pulled from Dynamics NAV using a webservice call to the ExportCustomers endpoint. The retrieval is paginated, with the page size controlled by the CustomerSyncPageSize setting. Customers can be excluded based on their 'Blocked' status in Dynamics NAV, configured via the ExcludeCustomers setting.
The connector connects to Dynamics NAV using the URL, username, password, and authentication type specified in the connector settings. The authentication type can be configured as Windows, Ntlm, Digest, or Basic using the AuthenticationType setting.
Customer Data Mapping
App4Sales Field | Source Field (Dynamics NAV) | Logic/Notes |
CustomerCode |
| Direct mapping. |
CustomerName |
| Direct mapping. |
VatCode |
| Direct mapping. This field is set to null if the App4Sales administration is configured for USA. |
FreeFields | Dynamic | Populated from a combination of the |
DynamicFreeFields | Dynamic | Populated from |
Discount |
| If |
VatLiable |
| Converts the string "Yes" or "No" from Dynamics NAV to a boolean value. This field is set to false if the App4Sales administration is configured for USA. |
UsesPriceField |
| Determines the App4Sales PriceList ID. If |
CustomerManager |
| Direct mapping. |
PaymentConditionCode |
| Direct mapping. If empty, it's set to null to prevent foreign key issues. |
DiscountGroup |
| Direct mapping. |
LanguageCode |
| Direct mapping, then mapped to App4Sales language codes using the |
Phone |
| Direct mapping, trimmed for whitespace. |
| Direct mapping, trimmed for whitespace. | |
MainContactPerson | Dynamic | If |
CustomerDashboard |
| Base64 encoded string from Dynamics NAV. Decoded and stored separately. The field in the App4Sales customer object is set to null after processing to optimize memory. |
CustomerNote |
| Dynamics NAV |
Addresses
App4Sales distinguishes between Invoice, Delivery, and Visit addresses. The connector consolidates address information from various Dynamics NAV fields.
App4Sales Field | Source Field (Dynamics NAV) | Logic/Notes |
Invoice Address (AddressType: "INV") | Invoice Address (AddressType: "INV") | Invoice Address (AddressType: "INV") |
AddressLine1 |
| Direct mapping. |
AddressLine2 |
| Direct mapping. |
PostCode |
| Direct mapping. |
City |
| Direct mapping. |
Country |
| Direct mapping. |
Iso2 |
| Direct mapping, then normalized using |
| Direct mapping. | |
Phone |
| Direct mapping. |
Delivery Addresses (AddressType: "DEL") | Delivery Addresses (AddressType: "DEL") | Delivery Addresses (AddressType: "DEL") |
AddressLine1 |
| If no specific Ship-To Address exists, the Invoice Address is used as a fallback. |
AddressLine2 |
| If no specific Ship-To Address exists, the Invoice Address is used as a fallback. |
AddressLine3 |
| Used for internal processing (e.g., when sending orders). |
PostCode |
| If no specific Ship-To Address exists, the Invoice Address is used as a fallback. |
City |
| If no specific Ship-To Address exists, the Invoice Address is used as a fallback. |
Country |
| If no specific Ship-To Address exists, the Invoice Address is used as a fallback. |
Iso2 |
| If no specific Ship-To Address exists, the Invoice Address's |
Phone |
| Direct mapping. |
Contact |
| Direct mapping. |
Visit Addresses (AddressType: "VIS") | Visit Addresses (AddressType: "VIS") | Visit Addresses (AddressType: "VIS") |
AddressLine1 |
| If no specific contact address exists, the Invoice Address is used as a fallback. |
AddressLine2 |
| If no specific contact address exists, the Invoice Address is used as a fallback. |
PostCode |
| If no specific contact address exists, the Invoice Address is used as a fallback. |
City |
| If no specific contact address exists, the Invoice Address is used as a fallback. |
Country |
| If no specific contact address exists, the Invoice Address is used as a fallback. |
| If no specific contact address exists, the Invoice Address is used as a fallback. | |
Phone |
| If no specific contact address exists, the Invoice Address is used as a fallback. |
Contacts
Contact persons associated with the customer are mapped from Dynamics NAV. Full name parsing and dynamic free field mapping are supported.
App4Sales Field | Source Field (Dynamics NAV) | Logic/Notes |
ContactId |
| If empty and the system is running in Updater mode, a ContactId is generated from the hash code of the contact person object. |
FullName |
| If |
FirstName | Derived from | Parsed from |
MiddleName | Derived from | Parsed from |
LastName | Derived from | Parsed from |
Initials | Derived from | First character of |
| Direct mapping, trimmed for whitespace. | |
Phonenumber |
| Direct mapping. |
MobileNumber |
| Direct mapping. |
Function |
| Direct mapping. |
DynamicFreeFields | Dynamic | Similar to customer dynamic free fields, contact person dynamic free fields are mapped from |
Discounts
Customer-specific discounts, including those per item class value, are synchronized.
App4Sales Field | Source Field (Dynamics NAV) | Logic/Notes |
DiscountsPerItemCLassValue | Derived from Extra Data (CSV/FTP) | If |
Dashboards & Notes
Customer dashboard layouts and notes are synchronized. Customer dashboards are base64 encoded XML structures.
App4Sales Field | Source Field (Dynamics NAV) | Logic/Notes |
CustomerDashboard |
| Base64-encoded string representing the dashboard layout. This is decoded and stored separately in the database. The customer object's |
CustomerNotes |
|
|
Extra Data & Free Fields
Extra data from FTP/CSV sources can override standard customer fields and populate free fields.
App4Sales Field | Source Field (FTP/CSV Extra Data) | Logic/Notes |
Customer properties | Matching property names in | Properties in the |
FreeFieldList |
| Elements in the |
ItemFilter |
| If |
Special Logic & Filters
Paging: Customer retrieval from Dynamics NAV uses pagination, configured by the
CustomerSyncPageSizesetting.Customer Exclusion: Customers can be excluded from synchronization based on their 'Blocked' status in Dynamics NAV, using the
ExcludeCustomerssetting. Valid values forExcludeCustomersare "Ship", "Invoice", "All", which correspond to different blocking states in Dynamics NAV.GUID Management: The system attempts to reuse GUIDs for inactive customers to maintain data integrity and links to historical data (e.g., notes, orders). If no GUID is found, a new one is generated.
Script Hooks:
BeforeUpdateCustomers: Executed before any customer processing begins, allowing for custom logic on the raw customer data.UpdateCustomers: Executed after each batch of customers is processed, and again after all batches are complete, allowing for further custom modifications.
Email Address Normalization: Email addresses for both customers and contact persons are trimmed of leading/trailing whitespace and invalid unicode characters.
VAT for USA Administrations: For App4Sales administrations configured for the USA, VAT-related fields (
VatCodeandVatLiable) are explicitly set to null/false.Missing Address Handling: If a customer lacks valid delivery or visit addresses, the system attempts to create dummy addresses based on the available invoice address to ensure complete address information.
Empty Payment Condition Code: An empty
PaymentConditionCodefrom Dynamics NAV is converted tonullto prevent foreign key constraint issues in App4Sales.Price Deduplication Migration: If enabled (via
EnablePriceDeduplicationin connector base settings or sync settings), customers' associated pricelists are migrated to deduplicated versions based on a lookup table.
Related Settings & Prerequisites
CustomerVatProductPostingGroup: Defines the VAT Product Posting Group used when retrieving customer data from Dynamics NAV.CustomerFreeFieldsConfig: (Hidden Setting) Configuration string for mapping custom free fields.ExcludeCustomers: Comma-separated list of values (e.g., "Ship,Invoice") to exclude customers based on their 'Blocked' status in Dynamics NAV.CustomerShippingCodeMethod: Default shipment method code for new customers.CustomerShippingAgentCodeMethod: Default shipment agent code for new customers.CustomerShippingAgentServiceCodeMethod: Default shipment agent service code for new customers.CustomerInvoiceDiscountCode: Default invoice discount code for new customers.CustomerLocationCode: Default location code for new customers.CustomerDefaultLanguageCode: Default language code for new customers.CustomerDefaultSalesPersonCode: Default salesperson code for new customers.CustomerShipToAddressCode: Default shipping address code for new customers.CustomerDefaultSalutationCode: Default salutation code for new customers.VatDomesticPostingGroup: VAT Domestic Posting Group used for VAT liable code determination.VatDomesticCountryCode: VAT Domestic Country Code used for VAT liable code determination.VatEuLiablePostingGroup: VAT EU Liable Posting Group used for VAT liable code determination.VatEuNotLiablePostingGroup: VAT EU Not Liable Posting Group used for VAT liable code determination.VatOtherPostingGroup: VAT Other Posting Group used for VAT liable code determination.CustomerBaseCalendarCode: Base calendar code for new customers.CustomerDefaultGenBusPostingGroup: Default customer general business posting group for new customers.CustomerDefaultPostingGroup: Default customer posting group for new customers.DiscountCustomTableField: Specifies a custom table or field in Dynamics NAV from which to retrieve customer discount.PriceListBasedOnCodeAndCurrency: Boolean flag indicating if the pricelist code should be constructed using both the customer price group and currency code.DefaultCustomerCurrencyCode: Default currency code used ifCustomerCurrencyCodeis empty.ContactFunctionToDetermineMain: Text value representing the 'Function' of a contact person in Dynamics NAV to identify the main contact.CustomerSyncPageSize: (Hidden Setting) Defines the number of customer records to retrieve per page during synchronization.CustomerItemFilter: (Sync Setting) Boolean flag to enable processing of customer-specific item filters from extra data.DefaultActionPriceListCode: (Connector Base Setting) If set, this pricelist code will be applied as the action pricelist for all customers if they don't have one specified.DontSendInvoiceDiscountOnCustomer: If true, prevents the invoice discount from being sent when creating or updating a customer.
Known Limitations
The
Subjectfield for customer notes currently maps directly from theCommentDatein Dynamics NAV, which may not always be an appropriate subject.If
ContactIdis empty for a contact person and the system is not in Updater mode, a newContactIdis not generated automatically based on the hash code.