Baan Connector - Customer Management
Overview
The Baan connector handles customer data in two ways:
Customer Creation: New customers are not created through a dedicated function. Instead, they are created implicitly when a sales order for a new customer is sent to Baan.
Customer Synchronization: Existing customers are synchronized from Baan to App4Sales.
Baan - Create Customer (via Sales Order)
Trigger & Permissions
A new customer is created in Baan when a sales order is submitted from App4Sales for a customer that does not yet exist in Baan. This process is handled by the SendOrderToBackoffice function. The creation is triggered when an order is placed in the App4Sales app. The setting ConnectorInfoInternalIds.AlternativeAddress must be enabled.
Payload Mapping
The customer data is part of the sales order XML that is sent to the Baan web service. The connector itself does not perform the mapping from App4Sales fields to the XML fields. This mapping is performed by the App4Sales core framework before the connector's SendOrderToBackoffice method is called. The XML is then sent to the A4SInsertSalesOrder SOAP web service method.
The following is a conceptual representation of the data that is likely sent for a new customer. The exact XML element names may vary.
App4Sales Field | Source Field (API/Excel/DB) | Logic/Notes |
Customer Name | Derived from Order | The customer's name is included in the order XML. |
Address (Delivery) | Derived from Order | The delivery address is included in the order XML. |
Address (Invoice) | Derived from Order | The invoice address is included in the order XML. |
Contact Person | Derived from Order | Contact person details are included in the order XML. |
Validation & Defaults
The connector replaces hyphens in date fields within the order XML before sending it to Baan. No other validation or default value logic is present in the connector for customer data.
Response & Error Handling
The Baan web service returns a response string. If the order (and customer) creation is successful, this string is expected to be the new order number, which is then saved in the App4Sales database. If an error occurs during the process, the error message from the web service is returned.
Baan - Customer Synchronization
Overview
This function synchronizes customer data from Baan to App4Sales. It retrieves a list of all customers from Baan and updates the App4Sales database. This process is handled by the CustomerUpdate method.
Data Source Configuration
The connector calls the A4SListCustomers SOAP web service method to retrieve an XML document containing all customers. The URL for the web service is configured in the administration settings.
Data Mapping Table
App4Sales Field | Source Field (API/Excel/DB) | Logic/Notes |
CustomerGuid | customers.customerGUID | If the source field is empty, a new GUID is generated. The connector also attempts to look up an existing GUID based on the customer code. |
CustomerCode | customers.customerCode | The value is trimmed. |
CustomerName | customers.customerName | Direct mapping. |
LanguageCode | customers.languageCode | Direct mapping. |
Discount | customers.discount | The value is converted to a decimal. If the source is empty or null, it defaults to 0. |
CustomerManager | customers.customerManager | Direct mapping. |
CustomerDashboard | customers.customerDashboard | If the source is empty, it defaults to an empty string. |
Sysmodified | customers.sysmodified / customers.lastModified | Uses |
VatCode | customers.VATCode | Direct mapping. |
VatLiable | customers.isVATLiable | The value is converted to a boolean. |
ContactPersons[0].FullName | customers.contactFullName | A single contact person is created. |
Addresses[0] (Delivery) | Multiple | A delivery address is created using `customers.deliveryAddress1`, `customers.deliveryPostCode`, `customers.deliveryCity`, and `customers.contactPhone`. The country is set to the customer's language code. |
Addresses[1] (Visit) | Multiple | A visit address is created using `customers.visitAddress1`, `customers.visitPostCode`, `customers.visitCity`, and `customers.contactPhone`. The country is set to the customer's language code. |
Special Logic & Filters
The connector ensures that certain fields have default values if they are not provided by the Baan web service. For example, `discount` defaults to "0" and `customerDashboard` defaults to an empty string. It also handles two possible source fields for the postal code (`customers.invoicePostCode` and `customers.invoicePostalCode`) and modification date (`customers.sysmodified` and `customers.lastModified`).