Orders

Introduction

Syncing order information between a Business Central database and a webshop remains one of the most used features of the Tinx connector. By using the connector, customers can download all kinds of data related to an order, such as the end-customer, line items and shipping. But also often things like meta data and other customized fields. In general, if data is accessible via the REST API of the webshop, the connector (possible with some mapping changes) is able to access this data and copy it into your BC database.

Below we will explain various aspects of order processing within the Tinx connector. To start, we'll discuss parameter setting which is done in the E-Commerce Setup. Then the flow of orders and associated tables that are used for processing and finally the mapping that is used and can be tweaked to fit your unique needs.

 

E-Commerce Parameters

To set up parameters for importing web orders, head to E-commerce Integration Setup > Orders. There, fill in the parameters as seen below.

 

Field Description
Webshop Guest Customer No. To which customer no. should the web orders be assigned that are submitted by non-registered customers (Guest Accounts) in your webshop?
Freight Cost Type What is the type of the freight costs in a order: G/L Account, Item, Resource, Fixed Asset, Charge Item? Value can be used in the import of the order by Message Definition xxx-087 (MAG2-087 in case of Magento).
Freight Cost No. To which no. should freight costs be applied to in a order?
No. Of Order Checks How many times should an order get checked if it has the right status in the webshop?
No. of Days Order to 'Processed NAV' Which webshop status should be ignored when checking an order's status? Clients tend to use 'canceled' and/or 'completed' for this, because orders with such a status should not be created as Sales Headers in BC.
Sales Person Assign the web order to a Sales Person code. This value is used in Message Definition xxx-087.
Different Table No. Sales Order This should only be filled when you don't import submitted web orders into the standard Sales Header table (36). This would be the case if you are using an add-on which stores orders in a specific table. Please check your Message Definition (xxx-087) in which table you import the orders.
Handle Product Options

If custom options are available for orders, choose the appropriate way you wish to handle them. Options:

  • Create as New Sales Line. Each custom option will be added as a new sales line, by setting Label in Description and Value in the Description 2 fields.
  • Link Option to Field. Possible only in the case you use one single custom option, for example Unit of Measure. Link the value to the field in the sales line in the mapping xxx-087 on the items section.
  • Create as Dimension. Custom Options will be added as dimensions on the sales line.
Custom Option Element Name Options: Value or Title.
Product Type in Webshop OrderLine What product type do you use in the webshop order lines? Options include Bundle, Configurable and Configurator.
Turn Off Check Legacy functionality.

 

Flow of Orders

The creation of webshop orders in Business Central has various steps and prerequisites. Below a summary.

  1. There must be a functional connection between the webshop and ERP.
  2. The items that the customer orders on the webshop must have a link in BC. This normally means a match can be made via our Webshop Product table (11205274) for items with the item table (27).
  3. A customer card is needed in BC to book the order on. This can be either an individual customer card (created for each customer) or a universal customer card that is used for all orders, regardless of end-customer (e.g. 'Webshop Orders').
  4. New webshop orders are first downloaded into a custom Tinx table, Webshop Orders (11205270).
  5. Then, based on certain filter criteria that can be altered, web orders are converted to sales orders in the Sales Headers table (36). Filters could for example be the payment status of an order, whether the order was placed by a registered customer or a guest and whether the items ordered can be matched in Business Central or not.
  6. All relevant administrative data must of course be present to create a sales order. Think of posting groups, number series, stock of products, prices, etc.
  7. For many customers, the job of the connector is done once sales headers have been created. Customers then internally go about following steps within BC, such as invoicing and shipping. If desired, however, the connector can automate these further steps as well. To read more about these, go to the Order Events page.
  8. Additionally, the connector can update the status of an order in the webshop. This is often set up to occur based on a trigger on the Sales Shipment Header (110) or the Sales Invoice Header table (112). The these documents are created for a sales order, the connector can send a message back to the webshop changing the status to 'completed' or 'shipped'.
  9. As part of this update message you can also send track and trace information. Note though that in order to send this information, configuration is likely required both in BC as in the webshop.

Some key fields in this table are the following.

  1. Processed ERP. This box is checked if the connector successfully created a sales order from a web order. This is an important filter criteria, as one obviously does not want multiple sales orders created in Business Central for a single web order.
  2. Order Record ID. If filled in, this shows the record ID of a sales order that was created. You can open the sales order via the banner via Order > Quote/Order > Show Document.
  3. Status. The (payment) status of an order in the webshop. Another important filter that is used to determine which web order to convert to sales order. Usually statuses such as 'pending' or 'processing' are used, as opposed to 'canceled' or 'on-hold'.

  4. Default Customer No.There must, of course, be a customer to book. This is either handled by customer templates in the setup or as a default customer in the message itself (i.e. all orders are booked a universal customer. If the connector can match the customer ID from the webshop with a customer card in BC, then this field is populated with the customer no. of that customer card. When used as a filter, this ensures that you only create orders for registered customers (i.e. that have an account and might subscribe to newsletters).

  5. Failed to Import. When the sync process starts, this is set to 1. When the process is finished, it is set back to 0. If there is an error during this process, this prevents a loop from occurring.

  6. Blocked Customer. The customer card must not be blocked in BC. This is based on the customer's choice.

  7. Blocked. This filter checks whether there is an item in the order lines that is not in the webshop product table. If not, it will be marked as blocked.

 

Message Definitions

There are several messages (usually three) that are used in order to get sales orders made in BC using web data. These can be found in Synchronisation Dashboard, under the order inbound code. Examples are WOO-IN-ORDERS, SHOP-IN-ORDERS, M2R-IN-ORDERS.

The messages themselves often start with the code for the connector in use (WOO = WooCommerce, SHOP = Shopify, M2R = Magento) and 086, 086-1 or 087-1 and 087.

 

As seen above, by default the WooCommerce connector has three messages.

  1. The first message WOO-086 checks if new orders are submitted in the webshop. A list request basically of any new orders placed on the webshop. The latest order ID will be checked or a datetimestamp is saved to check whether new orders are available.
  2. The second message WOO-086-1 downloads additional data such as the order lines, shipping costs and discounts as well as additional meta data if present.
  3. The third message WOO-087 is the message that actually creates a sales header document in BC. To this message the filters are added that were described above.

Matching Items of Orders
Within the connector code, there is a check that looks to the order lines during the download of orders to see if products can be found in the Webshop Product table. If there are any that can not be found in Webshop Product Table, the 'Blocked order' checkbox is checked. This check happens regardless of whether you actually use the Webshop Product table or not.

You can use this filter to configure the connector only to create sales headers with items present in this table, but that is not mandatory. In the 087 message, the connector normally looks to table 36, where it checks whether the item is present in BC (in table 27). It does this based on the SKU of the JSON from the webshop.

The match then is between Item no. = Webshop SKU.

If the filter Blocked is removed, the webshop product table can in principle remain empty, as long as the relationship above remains the same.

 

Matching Customers of Orders
When using the connector, there are 3 ways to make a match with a customer number.

Default Customer No. (73) is a flow field based on the Webshop Customer ID. The connector checks if there is a match in the Webshop Customer table. If yes, then use that customer number of the card. This number is also the same number used in the creation of a customer card via the connector.

BC/NAV Customer No. (95) seeks a match based on the customer's email address. If one creates a new customer card and uses the same email address, the match from an order can only be done on email, not on customer card. An email may only have one match.

Different Customer No. Order (59). This looks to the contact-customer relationship structure. It is used in situations where an order is placed with customer A, but the order must be booked on customer B. Generally this is for clients that use a company substructure or sub-login functionality.