Uniconta Connector - Send Order to Backoffice
Overview
The Uniconta connector facilitates the transfer of sales orders from App4Sales to the Uniconta ERP system. This process, initiated by the SendOrderToBackoffice function, ensures that customer orders, including order headers, individual order lines, and associated attachments, are accurately transmitted. The connector handles data transformations, pricing calculations, and manages error responses from the ERP.
Data Source Configuration
The connector operates by pushing order data directly to the Uniconta ERP system via its API. There are no external files or SQL databases used as data sources for sending orders; all data originates from the App4Sales internal database and is formatted for the Uniconta API endpoints.
Data Mapping Table: Order Header
App4Sales Field | Source Field (API/Excel/DB) | Logic/Notes |
Your Reference |
| Directly mapped. |
Our Reference |
| If the setting "Add username to our reference field" ( |
Contact Name |
| Uses the full name of the order's contact person. If not available, falls back to the main contact person of the customer. |
Delivery Address Line 1 |
| If the setting "Send order alternative address as delivery if exists" ( |
Delivery Address Line 2 |
| (See Delivery Address Line 1) |
Delivery Address Line 3 |
| (See Delivery Address Line 1) |
Delivery City |
| (See Delivery Address Line 1) |
Delivery Zip Code |
| (See Delivery Address Line 1) |
Delivery Country |
| Derived from the ISO code ( |
Delivery Date |
| Directly mapped from the order date. |
Payment Condition |
| Directly mapped from the customer's payment condition code. |
Total Quantity | Derived | Sum of all quantities from individual order lines. |
Remark |
| Directly mapped from the order's notes. |
Currency |
| Directly mapped from the customer's currency. |
Data Mapping Table: Order Line
App4Sales Field | Source Field (API/Excel/DB) | Logic/Notes |
Note |
| Directly mapped. |
EAN Code |
| Directly mapped. |
Item Code |
| If the setting "Use Variants as part of Item code" ( |
Quantity |
| Directly mapped. |
Quantity Delivered |
| Directly mapped. |
Line Number |
| Directly mapped. |
Unit |
| Directly mapped. |
Variant 1-5 |
| If the setting "Use Variants as part of Item code" ( |
Quantity Now (Lever Nu) |
| If the setting "Fill in the order line quantity in the field 'Lever Nu'" ( |
Price |
| The price determination is complex:
|
Discount Percentage |
| Set based on pricing logic:
|
Discount Amount |
| Set based on pricing logic:
|
Charges & Attachments
The connector supports sending attachments associated with an order to Uniconta. The GetOrderAttachments method retrieves documents that have been linked to the order in App4Sales. These attachments are converted into a format suitable for Uniconta, including their caption, base64 encoded content, and a derived filename.
Note: There is a limit of 5 attachments processed per order.
No specific logic for "charge lines" (e.g., freight, payment fees) was found within the SendOrder or SendOrderLines methods; these would typically be handled as separate order lines if supported.
Domain Specifics
Order Header Logic
The order header captures essential metadata for the order. Key logic includes:
Reference Generation: The ERP reference (
OurRef) can be prefixed with the sales representative's username if configured by theAddUsernameToReferencesetting. This helps in identifying the originator of the order within Uniconta.Contact Person: The primary contact person for the order is determined first by an order-specific contact, falling back to the customer's main contact person if no order-specific contact is available.
Delivery Address Selection: The delivery address sent to Uniconta is dynamically selected. If an alternate delivery address is provided for the order in App4Sales and the setting
SendOrderAlternativeAddressAsDeliveryIfExistsis enabled, this alternate address will be used. Otherwise, the default delivery address associated with the customer in App4Sales is utilized. The country code for the delivery address is derived from its ISO code.
Line & Pricing Logic
Order line processing is critical for accurate item, quantity, and pricing transfer:
Item Code Variants: The connector supports item variants. If the
UseVariantsAsPartOfItemCodesetting is active, the App4Sales item code is parsed to separate the base item code from its variants. The base code is mapped to the UnicontaItemfield, while up to five variant values are mapped to Uniconta'sVariant1throughVariant5fields.Quantity Now (Lever Nu): The
FillLeverNuForOrderLinesetting, if enabled, will populate the Uniconta order line's "Quantity Now" field with the ordered quantity.Pricing Determination: Pricing is determined through a multi-tiered approach:
The system first attempts to retrieve customer-specific price information.
If no specific customer price is found, a warning is logged, and pricing defaults to the order line's price in App4Sales. If that is also zero, the item's standard sales price is used.
For returned items (negative quantities), the original base price is applied, and any discounts are reversed.
For order lines with manually applied discount percentages in App4Sales, the price is recalculated to reflect this discount, and the discount percentage is explicitly set.
Otherwise, the connector applies the determined base price and associated discount percentage and amount from the customer's price information.
The setting
CalculateDiscountForOrderLinesWhenSendingOrderToBackofficedetermines whether discount calculation happens during the order sending process.
Charges & Attachments
The connector can transfer various types of documents attached to an order from App4Sales to Uniconta. These documents are processed and encoded for transmission, appearing as attachments within the Uniconta order. The system currently supports a maximum of 5 attachments per order. No explicit functionality for separate "charge lines" (e.g., handling for shipping costs or payment surcharges as distinct line types) was identified; such charges would typically need to be represented as standard order lines if desired.
Responses & Error Handling
After sending an order, the connector processes the response from Uniconta:
Order Number Retrieval: Upon successful order creation in Uniconta, the assigned Uniconta order number is retrieved and used to update the corresponding order within the App4Sales database.
Error Conditions:
If the customer associated with the order is not found in Uniconta, the order creation will fail, and an error message indicating the missing customer will be logged and returned to App4Sales.
If Uniconta does not return an order number after successful processing, an error is logged.
Any general exceptions during order creation or line item insertion in Uniconta will result in an error message being logged and returned to App4Sales.
Transaction Rollback: Critically, if the order lines fail to be sent to Uniconta after the order header has been successfully created, the entire order in Uniconta is automatically deleted to maintain data integrity.
Related Settings & Prerequisites
The following settings influence the behavior of the Uniconta Send Order process:
Add username to our reference field (
AddUsernameToReference): If enabled, the sales representative's username is prepended to the order's reference in Uniconta.Send order alternative address as delivery if exists (
SendOrderAlternativeAddressAsDeliveryIfExists): If enabled, and an alternate address is present on the App4Sales order, that address will be used as the delivery address in Uniconta.Use Variants as part of Item code (
UseVariantsAsPartOfItemCode): When enabled, the App4Sales item code is parsed to extract and map item variants to corresponding Uniconta variant fields.Fill in the order line quantity in the field 'Lever Nu' (
FillLeverNuForOrderLine): If enabled, the 'Quantity Now' field in Uniconta order lines will be populated with the ordered quantity.Calculate discount for order lines when sending order to backoffice (
CalculateDiscountForOrderLinesWhenSendingOrderToBackoffice): This setting determines whether the system performs discount calculations on order lines during the send order process.
Known Limitations
Only a maximum of 5 attachments per order are currently supported for transfer to Uniconta.
Explicit handling for "charge lines" (e.g., separate line types for freight, payment fees) is not present; these would need to be integrated as standard order lines if required.