Winbas Connector - Create Customer
This document details the process by which new customer records created within the App4Sales platform are synchronized and created in the Winbas ERP system via the Winbas Connector. The synchronization is triggered when a new customer is created in App4Sales, either through the portal or the mobile application. The connector transforms App4Sales customer data into a Winbas-compatible XML format, which is then saved to a predefined directory for import into Winbas.
Trigger & Permissions
The customer creation flow is initiated by the App4Sales platform when a new customer is submitted. This process is handled by the OptA4SNewCustomers method within the Winbas Connector, which is enabled by the Constants.ConnectorInfoInternalIds.CreateCustomer flag. This flag must be active for the customer creation functionality to be available.
Data Source Configuration
The data source for customer creation is the App4Sales platform itself. The connector retrieves the complete customer object, including associated contact persons and addresses, directly from the App4Sales internal systems. The transformed customer data is then outputted as an XML file to a directory configured within the Winbas Connector settings, typically an export folder monitored by the Winbas ERP system for import.
Payload Mapping
Customer Header Fields
App4Sales Field | Source Field (API/Excel/DB) | Logic/Notes |
CustomerCode |
| Directly mapped. |
CustomerName |
| The customer's name is taken. If the name contains a " - SN: " prefix, this prefix and everything after it is removed. |
Discount |
| App4Sales decimal discount value is converted to a float. |
CustomerManager |
| Directly mapped to the Winbas SalesmanCode. |
LanguageCode |
| Directly mapped. |
PaymentConditionCode |
| Directly mapped to Winbas TermsOfPayment. |
Contact Persons
Only the first contact person associated with the App4Sales customer is processed and mapped to a Winbas Customer Reference.
App4Sales Field | Source Field (API/Excel/DB) | Logic/Notes |
FullName |
| Mapped to Winbas Reference Name. |
| Mapped to Winbas Reference EMail. | |
Phonenumber |
| Mapped to Winbas Reference Telephone. |
isMainReference | N/A | Hardcoded to |
Addresses
The connector processes addresses based on their AddressType. It specifically looks for a "VIS" (visiting) address and a "DEL" (delivery) address. If both are present, email, telephone, and telefax from the delivery address will overwrite values from the visiting address.
App4Sales Field | Source Field (API/Excel/DB) | Logic/Notes |
Visiting Address (AddressType = "vis") | Visiting Address (AddressType = "vis") | Visiting Address (AddressType = "vis") |
AddressLine1 |
| Mapped to Winbas VisitingAddress. |
| Mapped to Winbas eMail. | |
Phone |
| Mapped to Winbas Telephone. |
Fax |
| Mapped to Winbas Telefax. |
PostCode, City |
| Concatenated as "PostCode City" and mapped to Winbas PostAddress. |
Delivery Address (AddressType = "del") | Delivery Address (AddressType = "del") | Delivery Address (AddressType = "del") |
AddressLine1 |
| Mapped to Winbas DeliveryAddress. |
| Mapped to Winbas eMail (overwrites if visiting address also provided email). | |
Phone |
| Mapped to Winbas Telephone (overwrites if visiting address also provided phone). |
Fax |
| Mapped to Winbas Telefax (overwrites if visiting address also provided fax). |
Iso2 |
| Mapped to Winbas CountryCode. |
Validation & Defaults
Customer Name Transformation: The
CustomerNamefrom App4Sales is processed to remove any " - SN: " suffix, which is typically used for internal search names. Only the part before this suffix is used as the Winbas customer name.Discount Conversion: The discount value is converted from a decimal (App4Sales) to a float (Winbas).
Contact Person as Main Reference: The first contact person found in App4Sales is designated as the main reference in Winbas by setting
isMainReferencetotrue.Post Address Splitting: The Winbas
PostAddressfield (e.g., "1234 AB City") is constructed by concatenating the App4SalesPostCodeandCity.Address Overwriting: If both a visiting address and a delivery address are provided, the email, telephone, and telefax from the delivery address will take precedence and overwrite the values from the visiting address in the Winbas customer record.
Response & Error Handling
Upon attempting to create the customer in Winbas:
Success: If the customer XML file is successfully saved to the designated directory, the connector returns a success message including the
CustomerCodeof the newly created customer (e.g., "Succes: CUST123").Failure: If there is an issue saving the customer file, the connector returns a generic error message (
Constants.Error.ERRORAdmin).XML Output: The customer data is serialized into an XML file named after the customer's GUID (e.g.,
[CustomerGUID].xml) and placed in the directory returned byGetExportedCustomersDirectory().