Muis Connector - Customer Update
This document describes the process of updating customer data from Muis into App4Sales. The connector retrieves customer, address, and contact person data from the Muis API, transforms it, and then updates the App4Sales database.
Data Source Configuration
The connector retrieves data from a Muis environment using a SOAP API. The specific endpoint is composed from the administration's address and the Muis constants. The following data tables are queried:
DEB: Main customer data.
DEBADRES: Customer addresses.
CNT: Contact persons.
BETCOND: Payment conditions.
Authentication is handled via a session-based login mechanism, using a PartnerKey, EnvironmentCode, and a session ID.
Customer Core Fields
App4Sales Field | Source Field (API/Excel/DB) | Logic/Notes |
CustomerCode | NR | The customer's unique code. |
CustomerName | NAAM | The name of the customer. |
CustomerEnabled | Hardcoded to | |
CustomerManager | VERKOPER | The sales representative linked to the customer. |
ChamberOfCommerceCode | KVKNR | The Chamber of Commerce registration number. |
LanguageCode | TAAL | The language code for the customer. This is later mapped to a language code recognized by App4Sales. |
DeliveryMethod | LEVCOND | The delivery condition for the customer. |
VatCode | BTWNR | The VAT number of the customer. |
VatLiable | BTWPL | A string value ('J' for Yes, 'N' for No) is converted to a boolean. |
PaymentConditionCode | BETCOND | The code for the customer's payment condition. |
UsesPriceField | PRSLST | The pricelist code from Muis. This is hashed to generate an ID. |
Phone | TEL | The customer's telephone number. |
Inactive | BLOK | Customers with 'BLOK' set to 'J' (Yes) are filtered out and not processed. |
Addresses
The connector processes addresses from both the main customer record (DEB) and the separate address table (DEBADRES). Only addresses with type 'B' (Bezoek/Visit) and 'V' (Verzend/Delivery) are included.
App4Sales Field | Source Field (API/Excel/DB) | Logic/Notes |
AddressLine1 | ADRES | The main address line. |
PostCode | POSTCD | The postal code. |
City | PLAATS | The city. |
Country / Iso2 | LAND | The country. The system attempts to map this to a 2-letter ISO code. |
The email address for the address. | ||
Fax | FAX | The fax number for the address. |
Phone | TEL | The telephone number for the address. |
AddressType | SRT | The Muis address type ('SRT' field in DEBADRES) is mapped to App4Sales address types. 'b' becomes 'VIS' (Visit), 'f' becomes 'INV' (Invoice), and other types default to 'DEL' (Delivery). The main address from the customer record is set as 'VIS'. |
IsMainAddress | - | The first address of a certain type becomes the main address for that type. |
Inactive | BLOK | Addresses with 'BLOK' set to 'J' (Yes) are filtered out. |
If a customer has only a Visit or only a Delivery address, a corresponding Delivery or Visit address is created by copying the existing one. This ensures every customer has both a Visit and Delivery address.
Contacts
App4Sales Field | Source Field (API/Excel/DB) | Logic/Notes |
ContactId | NR | The contact person's unique ID. |
FullName | VOORLTRS, TSNVGSL, ACHTERNM | Constructed by combining Initials, Insertion, and Last Name. |
FirstName | VOORLTRS | Mapped from the contact's initials. |
LastName | ACHTERNM | The last name of the contact. |
Initials | VOORLTRS | The initials of the contact. |
The contact's email address. | ||
Phonenumber | TEL | The contact's telephone number. |
Function | FUNCTIE | The job title of the contact. |
Gender | GESLACHT | The gender of the contact. |
Department | AFD | The department the contact works in. Mapped to the 'Pred' field. |
Inactive | BLOK | Contact persons with 'BLOK' set to 'J' (Yes) are filtered out. |
Special Logic & Filters
Customer Filtering: Customers are only processed if they have both a `CustomerName` and a `CustomerCode`. Customers marked as inactive (`BLOK` = 'J') are skipped.
Address Filtering: Addresses from the `DEBADRES` table are only included if their type (`SRT`) is 'b' (Visit) or 'v' (Delivery). Inactive addresses are skipped.
Contact Person Filtering: Inactive contact persons (`BLOK` = 'J') are skipped.
GUID Handling: The system attempts to reuse existing `CustomerGuid`s for customers. If a GUID is not found, a new one is generated. Inactive customers can be reactivated, reusing their old GUID.
Main Contact Person: If a `MainContactPerson` is provided, it's marked as such. If not, the first contact person in the list is designated as the main contact.
Address Normalization: The system ensures country codes are mapped to ISO 2 standards. It also parses `AddressLine1` to attempt to split it into street, house number, and addition if it's not already done.
Default Action Pricelist: A default action pricelist can be set for all customers via the `DefaultActionPriceListCode` connector setting.
Dashboard and Notes: The logic handles updating customer-specific dashboards and notes. Base64 encoded dashboard data is decoded and stored. Customer notes from the backoffice are recreated on each sync.
Discounts: The system can process discounts per item class value if they are provided on the customer object.
Related Settings & Prerequisites
DefaultActionPriceListCode: If set, this pricelist code will be applied to all customers who do not have a specific action pricelist.
EnablePriceDeduplication: If enabled, the system will migrate customers to use deduplicated pricelists based on a predefined mapping.
Known Limitations
The connector does not appear to process `DiscountsPerItemClassValue` from the Muis API directly; this data seems to be expected from other sources.
The fields `FreeField1` to `FreeField5` on the `MuisCustomer` entity are retrieved but not mapped to any App4Sales customer fields.