Skip to main content

FTP - Send order

FTP Connector - Send Order To Backoffice Overview This function processes App4Sales orders and exports them as a CSV file to a confi...

Updated over a week ago

FTP Connector - Send Order To Backoffice

Overview

This function processes App4Sales orders and exports them as a CSV file to a configured FTP/SFTP server. It handles order headers and individual order lines. Surcharges, attachments, and payment information are not directly included in the generated CSV by the connector's internal CSV creation logic.

Data Source Configuration

Orders are retrieved from the internal App4Sales database using the provided order GUID. The FTP/SFTP server details (host, username, password, port, security settings) are configured within the connector's administration settings. The destination folder on the FTP server for orders is derived from the "Address" setting and is typically `[Configured Folder Name]/Orders/`.

Data Mapping Table - Order Header

App4Sales Field

Source Field (CSV)

Logic/Notes

Record Type

HEAD

Hardcoded value to identify the order header record.

Order Number

ordernr

Maps from Order.OrderNr. If Order.OrderNr is empty, a new order number is calculated by the system and assigned.

Customer Code

customercode

Maps from Order.Customer.CustomerCode.

Order Date

orderdate

Maps from Order.OrderDate. Formatted as a short date string (e.g., dd-MM-yyyy) based on "nl-NL" culture.

Your Reference

yourReference

Maps from Order.YourReference.

Reference

reference

Maps from Order.Reference.

Notes

notes

Maps from Order.Notes. Line feed characters are replaced if the "Replace line feeds with" setting is configured.

Order Type

orderType

Maps from Order.OrderType.ValueToBackoffice, which is the backoffice-specific value for the selected order type.

Data Mapping Table - Order Line

App4Sales Field

Source Field (CSV)

Logic/Notes

Record Type

LINE

Hardcoded value to identify an order line record.

Line Number

linenumber

Automatically incremented starting from 0 for each order line.

Item Code

orderline.Item.ItemCode

Maps from the item code of the order line.

Quantity

orderline.Quantity

Maps from the quantity specified for the order line.

Price

orderline.Price

Maps from the unit price of the order line. No internal calculation or modification is performed.

Unit

orderline.Unit

Maps from the unit of measure for the order line.

Discount

orderline.Discount

Maps from the discount value applied to the order line. No internal calculation or modification is performed.

Instruction

orderline.Instruction

Maps from the instruction text for the order line.

Special Logic & Filters

  • **Culture Setting:** The connector explicitly sets the thread's current culture to "nl-NL" for order processing, which influences date formatting.

  • **CSV Generation Method:** The connector can either generate the CSV content internally via CreateCsvOrders or use an external service via ExportDataServices.DownloadOrderCsvText, depending on the "Use template for CSV export to FTP" setting.

  • **Order Number Generation:** If an order does not have an existing order number, a new one is calculated by the App4Sales platform.

  • **Local File Storage:** Orders are temporarily saved as CSV files to a local directory before being uploaded to the FTP server.

  • **Error Handling (FTP Upload):** If the FTP upload fails, the order number might be reset in App4Sales, and an error message will be returned.

Domain Specifics / Extension Section

Order Header Logic

Customer selection, order numbering, and order type routing are handled at the App4Sales platform level. The connector extracts the customer code, order date, references, notes, and the backoffice-specific order type value for inclusion in the CSV header record.

Line & Pricing Logic

Order lines are exported with their item code, quantity, price, unit, discount, and instructions directly as present in the App4Sales order. The connector itself does not perform any complex pricing calculations, discount aggregations, or VAT adjustments; these are assumed to be finalized before the order reaches the connector.

Charges & Attachments

The internal CSV generation logic (CreateCsvOrders) of this connector does not include specific fields for surcharges (freight, payment fees, etc.) or attachments (PDFs, images). If these need to be exported, the "Use template for CSV export to FTP" setting should be enabled, and the external template would need to handle their inclusion.

Responses & Error Handling

Upon successful transmission, the order number is returned as an acknowledgment. In case of an FTP upload failure, an error message detailing the exception is returned, and the order number is reset within the App4Sales system. Duplicate order detection is not explicitly handled by this connector during the send process; this would typically be managed by the receiving ERP system or an upstream process.

Related Settings & Prerequisites

  • **Address:** The FTP/SFTP server address, including an optional folder path (e.g., `ftp://ftp.example.com/orders`).

  • **Username:** Username for authenticating with the FTP/SFTP server.

  • **Password:** Password for authenticating with the FTP/SFTP server.

  • **Use SFTP:** Boolean flag to specify whether SFTP (Secure File Transfer Protocol) should be used instead of standard FTP.

  • **Use TLS:** Boolean flag to enable TLS encryption for FTP connections.

  • **Use SSL:** Boolean flag to enable SSL encryption for FTP connections.

  • **Use template for CSV export to FTP:** Boolean flag. If true, an external service/template is used to generate the CSV; otherwise, the connector's internal logic generates the CSV.

  • **Remove semi colon at the end:** Boolean flag. If true, removes the trailing semicolon from generated CSV lines.

  • **Use source prefix on orders:** Boolean flag. If true, a prefix (e.g., A4S-, P4S-) based on the order's source application is added to the generated CSV filename.

  • **Replace line feeds with:** String value. If provided, line feed characters within order notes are replaced with this string in the exported CSV.

Known Limitations

The connector's internal CSV generation logic (CreateCsvOrders) does not export surcharges, attachments, or payment information. Only basic customer and item details are included in the CSV. Advanced pricing logic, VAT calculations, and complex discount structures are assumed to be resolved before the order reaches this connector for export.

Did this answer your question?