Uniconta Connector - Create Customer
This function handles the creation of new customer records in Uniconta, triggered when a new customer is submitted from the App4Sales platform. It also supports updating existing customer records if a matching customer code is provided. The process involves mapping App4Sales customer data to Uniconta's debtor structure, including core fields, addresses, contact persons, and custom user-defined fields.
Trigger & Permissions
The customer creation flow is triggered when a new customer is created or an existing one is updated within the App4Sales platform (e.g., via the mobile app or backoffice synchronization). This functionality is controlled by the following connector info flags:
EditCustomerCreateCustomer
These flags must be enabled in the connector's configuration for customer creation and updates to function.
Payload Mapping
Core Customer Fields
App4Sales Field | Source Field (Uniconta Debtor) | Logic/Notes |
|
| Direct mapping. |
|
| Email address of the main contact person. |
|
| If provided, this email is used for invoices; otherwise, the general |
|
| Full name of the main contact person. |
|
| App4Sales language code is parsed to a Uniconta language enum. |
|
| Mobile phone number of the main contact person. |
|
| General phone number. |
|
| VAT identification number. |
|
| Customer's website. |
|
| The code of the customer's assigned price list. |
|
| External currency code from the price list, parsed to Uniconta currency enum. Defaults to |
|
| Customer's payment condition code. |
|
| Parsed as a byte and then cast to Uniconta's |
|
| If an existing |
Visit Address Mapping
App4Sales Field | Source Field (Uniconta Debtor) | Logic/Notes |
|
| Direct mapping for the main address line. |
|
| Direct mapping for the second address line. |
|
| Direct mapping for the third address line. |
|
| ISO2 country code is converted to Uniconta's |
|
| Direct mapping for the city. |
|
| Direct mapping for the postal code. |
Delivery Address Mapping
App4Sales Field | Source Field (Uniconta Debtor) | Logic/Notes |
|
| Direct mapping for the delivery address line. |
|
| Direct mapping for the second delivery address line. |
|
| Direct mapping for the third delivery address line. |
|
| Direct mapping for the delivery city. |
|
| ISO2 country code is converted to Uniconta's |
|
| Direct mapping for the delivery postal code. |
Custom User Fields
Custom fields can be mapped from App4Sales to Uniconta user-defined fields based on the CustomerFreeFieldsConfiguration connector setting. This setting is a JSON string that defines the mapping between App4Sales fields (either entity properties or elements within UnknownElements) and Uniconta's user fields.
App4Sales Field | Source Field (Uniconta Debtor User Field) | Logic/Notes |
|
| Value is retrieved from |
Validation & Defaults
New Customer Code Generation: If no
CustomerCodeis provided from App4Sales, a new one is generated in the format "A4S " followed by theNextCustomerNumberfrom the connector settings. TheNextCustomerNumbersetting is incremented after a successful new customer creation.Country Code Conversion: App4Sales ISO2 country codes are converted to Uniconta's internal
CountryCodeenum. If conversion fails, the country information may be omitted, and the error is logged.Currency Conversion: The external currency code from the assigned price list is parsed into Uniconta's
Currenciesenum. If parsing fails, it defaults toCurrencies.XXX.Payment Method Conversion: The
PaymentConditionCodeis parsed to a byte and then cast to Uniconta'sPaymentTypesenum.
Response & Error Handling
Upon attempting to insert or update a customer, the connector calls the Uniconta API and checks the returned ErrorCodes.
Success: If the API call is successful (
ErrorCodes.Succes), the Uniconta customer account number (unicontaCustomer._Account) is returned as the newCustomerCodefor App4Sales. The customer cache within the connector is also expired to ensure fresh data on subsequent reads.Error: If the API returns an error code, an exception is thrown with a message indicating the error code and the customer code, providing details for troubleshooting.
Custom User Fields Update: Setting custom user fields is performed in a separate API call after the main customer insert/update. Any errors during this specific step are logged but do not block the overall customer creation if the initial insert/update was successful.
Related Settings & Prerequisites
NextCustomerNumber: An internal setting used to generate unique customer codes for new customers.CustomerFreeFieldsConfiguration: A JSON string configuring how custom App4Sales fields map to Uniconta's user-defined fields.Connector Info Flags:
EditCustomerandCreateCustomermust be enabled.
Known Limitations
The connector assumes that
PaymentConditionCodecan be safely parsed as a byte to derive the UnicontaPaymentTypesenum. Incorrect values may lead to errors.Errors during country code or currency parsing may result in incomplete address or currency information in Uniconta.