CSV Connector - Send Order
This document describes how the CSV connector processes and exports App4Sales orders. The connector can generate a CSV file in two different formats, depending on the configuration. The generated CSV file contains the order header and order line information. The export can be a "standard" fixed-format export, or a "custom" export that is configurable via a template in App4Sales.
Data Source Configuration
The order data is retrieved from the App4Sales database. The output is a CSV file. The connector does not send the file to a specific location. Instead, it generates the CSV content as a byte array, which is then handled by the App4Sales framework to be downloaded by the user or sent to an FTP server, depending on the context of the action.
Data Mapping
There are two possible export formats, controlled by the 'Download custom CSV export' setting.
Standard CSV Export
This export is used when the 'Download custom CSV export' setting is disabled. It generates a CSV file with 'HEAD' records for orders and 'LINE' records for order lines.
Order Header (HEAD) | Order Header (HEAD) | Order Header (HEAD) |
CSV Column | Source Field | Logic/Notes |
1 | "HEAD" | A hardcoded value indicating that the record is an order header. |
2 |
| The order number. |
3 |
| The code of the customer who placed the order. |
4 |
| The date of the order, formatted as 'dd-MM-yyyy'. |
5 |
| The name of the customer. |
6 |
| The backoffice value of the order type. |
Order Lines (LINE) | Order Lines (LINE) | Order Lines (LINE) |
CSV Column | Source Field | Logic/Notes |
1 | "LINE" | A hardcoded value indicating that the record is an order line. |
2 | (sequential) | A sequential number for each line, starting from 1. |
3 |
| The item code for the ordered item. |
4 |
| The ordered quantity, formatted to 3 decimal places. |
5 |
| The price per unit, formatted to 3 decimal places. |
6 |
| The unit of the ordered item (e.g., 'piece', 'box'). |
7 |
| The discount percentage for the order line, formatted to 3 decimal places. |
8 |
| The description of the order line. |
9 |
| Any special instructions for the order line. |
10 |
| The EAN code of the item. |
Custom CSV Export
This export is used when the 'Download custom CSV export' setting is enabled. The structure of this export is not fixed and is determined by an export definition template that can be configured in the App4Sales portal. The following fields are prepared by the connector and can be used in the template.
Order Header | Order Header | Order Header |
App4Sales Field | Source Field | Logic/Notes |
|
| The internal ID of the order. |
|
| The name of the customer. |
|
| The date of the order. |
|
| The creation date of the order in the database. |
|
| The total amount of the order. Defaults to 0 if not set. |
|
| The currency is retrieved from the customer's assigned pricelist. |
|
| The code of the customer. |
|
| The customer's reference for the order. |
|
| The internal reference for the order. |
|
| The sales representative for the order. |
|
| Indicates if the order has been delivered. |
|
| The source of the order. The value "Mood4Sales" is replaced with "App4Customers". |
|
| The notes for the order. |
|
| Any error message associated with the order. |
|
| The name of the order type. |
Order Lines | Order Lines | Order Lines |
The fields for order lines in the custom export are not predefined in the connector. Instead, they are based on the export definition configured in the App4Sales portal. All fields from the | The fields for order lines in the custom export are not predefined in the connector. Instead, they are based on the export definition configured in the App4Sales portal. All fields from the | The fields for order lines in the custom export are not predefined in the connector. Instead, they are based on the export definition configured in the App4Sales portal. All fields from the |
Domain Specifics
Order Header Logic
The header data is mapped differently based on the 'Download custom CSV export' setting. The standard export uses a fixed set of fields, while the custom export provides a richer set of data that can be mapped in a template.
Line & Pricing Logic
For the standard export, `Quantity`, `Price`, and `Discount` are formatted to 3 decimal places. For the custom export, the line mapping is entirely controlled by the export definition in App4Sales, and values are taken directly from the order lines.
Charges & Attachments
The analyzed code does not show any specific handling for charges (surcharges) or attachments. These are likely not supported by this connector's order export.
Responses & Error Handling
The connector's role is to generate a CSV file for export. It does not handle responses from an ERP system. If an order does not have a customer assigned, the export process will fail with an error.
Related Settings & Prerequisites
The following setting affects the order export process:
Download custom CSV export: A checkbox in the connector settings. If checked, the custom export format is used, which relies on a `CsvExportDefinition` template configured in the portal. If unchecked, the standard, fixed-format CSV is generated.
Known Limitations
The connector does not appear to support charges or attachments for orders.
The standard export format is rigid and includes a fixed set of columns in a specific order. Customizations require using the custom export feature.
The `SendOrderToBackoffice` implementation in this connector is a basic placeholder and is not involved in the CSV generation process. The actual logic resides in the `GetOrdersExportData` method, which is called during the file export process.