Add-ons and ModulesOrder Export

Order Export

Sana Commerce 8.2
Your provider

Order Export for AX

The order export functionality is used to export Sana Commerce orders from the SQL database to MS Dynamics AX database.

Order export functionality exports only orders which have status 'Paid' in the 'PaymentStatus' column of the 'Orders' table in the SQL database.

Each order has the 'ExportState' field, which indicates whether the order has been already exported, marked to export or not exported. There are three order states available:

  • '0' - Not exported: the order has not been exported yet;
  • '1' - Exported: the order has been already exported;
  • '2' - Marked: the order which should be exported.

After a new order is created in the SQL database, it receives the state 'Not exported'.
The export state of all orders that are going to be exported is changed to 'Marked' at the beginning of the order export process.
If the order export was successful the state in the 'ExportState' field is changed to 'Exported'.

If any problem occurred with the order during the export process, the state of the order will remain 'Marked'. The process will skip this order and continue to perform the order export. Next time the order export process will select the problematic order along with other not exported orders. Each order in the SQL database has the field 'ExportDate' (located in the XML fields), which stores the date and time of the moment the order was successfully exported.

During the order export the new customer is created in AX based on the country code of the billing address of the customer (the 'Delivery' address type in AX), because the country code is used in AX to determine the customer template. This relation can be found in the 'Country/region' form where the country code is mapped to the 'Country/region' field and the customer template is fetched from the 'Customer template' field. The customer template is used to add sales tax groups, discount groups and other AX-specific information for the created customer.

The Customer template must be determined in the 'Country/region' form for successful order export.

Note, that the customers' accounts should not coincide in two databases (SQL and AX) during the order export process. If the same customers' accounts exist in both databases it should be changed in one of the databases.

Payment costs and shipping costs of an order are imported into AX as miscellaneous charges with a specific ledger accounts according to the settings specified in the 'Webshops' form.

The TAX calculated for the payment cost and shipping cost will depend on the selected customer template (based on the country), sales tax group, posting profile and other relevant information of this customer. The prices for the payment cost and shipping cost will be set by the order import and does not depend on any setting in Dynamics AX.

The created customer and order in the AX database will get an automatically generated ID. The original 'Id' fields from the 'Customers' and 'Orders' tables in the SQL database are also saved in AX for each exported order. The customer 'Id' is saved in the 'Sana customer number' field in the 'Sales order' form in AX, while 'Id' of the order is saved in the 'Sana order number' field:

'Sana Order Number' and 'Sana Customer Number' Fields

Add-ons and ModulesOrder Export