Skip to main content

Winbas - Create customer

Winbas Connector - Create Customer This document details the process by which new customer records created within the App4Sales platform ...

Updated over a week ago

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

a4SCustomer.CustomerCode

Directly mapped.

CustomerName

a4SCustomer.CustomerName

The customer's name is taken. If the name contains a " - SN: " prefix, this prefix and everything after it is removed.

Discount

a4SCustomer.Discount

App4Sales decimal discount value is converted to a float.

CustomerManager

a4SCustomer.CustomerManager

Directly mapped to the Winbas SalesmanCode.

LanguageCode

a4SCustomer.LanguageCode

Directly mapped.

PaymentConditionCode

a4SCustomer.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

contactPerson.FullName

Mapped to Winbas Reference Name.

Email

contactPerson.Email

Mapped to Winbas Reference EMail.

Phonenumber

contactPerson.Phonenumber

Mapped to Winbas Reference Telephone.

isMainReference

N/A

Hardcoded to true for the Winbas customer reference.

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

visitAddress.AddressLine1

Mapped to Winbas VisitingAddress.

Email

visitAddress.Email

Mapped to Winbas eMail.

Phone

visitAddress.Phone

Mapped to Winbas Telephone.

Fax

visitAddress.Fax

Mapped to Winbas Telefax.

PostCode, City

visitAddress.PostCode, visitAddress.City

Concatenated as "PostCode City" and mapped to Winbas PostAddress.

Delivery Address (AddressType = "del")

Delivery Address (AddressType = "del")

Delivery Address (AddressType = "del")

AddressLine1

deliveryAddress.AddressLine1

Mapped to Winbas DeliveryAddress.

Email

deliveryAddress.Email

Mapped to Winbas eMail (overwrites if visiting address also provided email).

Phone

deliveryAddress.Phone

Mapped to Winbas Telephone (overwrites if visiting address also provided phone).

Fax

deliveryAddress.Fax

Mapped to Winbas Telefax (overwrites if visiting address also provided fax).

Iso2

deliveryAddress.Iso2

Mapped to Winbas CountryCode.

Validation & Defaults

  • Customer Name Transformation: The CustomerName from 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 isMainReference to true.

  • Post Address Splitting: The Winbas PostAddress field (e.g., "1234 AB City") is constructed by concatenating the App4Sales PostCode and City.

  • 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 CustomerCode of 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 by GetExportedCustomersDirectory().

Did this answer your question?