It may occur that orders are cancelled by customers and therefore have to be cancelled in Business Central. Orders may already be in process or entirely shipped and invoiced. The way in which they need to be handled is different.

We distinguish the following types of orders which can be cancelled:


  1. Staging Order
  2. Business Central Sales Order which is not shipped and invoiced.
  3. Business Central Sales Order which is not shipped and invoiced but paid in Magento.
  4. Remaining part of a Business Central Sales Order which is partially shipped and invoiced.


To show how the proces of cancelling an order works, we used the Magento order below for every type of cancelation.


1. Canceling a Staging Order in Business Central

When a Business Central staging order is not processed yet it can be canceled in the staging order. This can be done by navigating to the staging order and opening the one you want to cancel.



When the staging order is opened you click "Cancel Order" in the top menu and the order will be archived immediately.



When navigating to the staging order archive (Sales > Staging Order (Archived)) we see that the order is canceled.



This will also immediately reflect on the Magento order on header and line level.



2. Canceling a Business Central sales order which is not shipped and invoiced

When a staging order is processed, a Business Central sales order is created and there is no staging order to cancel anymore. Simply deleting the Business Central sales order will cause an error. In order to do this the right way the Magento order needs to be canceled first.


Navigate to the Business Central sales order you want to delete and click Related > Magento > Cancel Magento Order.



The notification bar will show that the Magento order is canceled successfully and the Magento Order Status field will update to "canceled".



You are now able to delete the Business Central sales order. When the pop up appears, click "Yes" to delete.



The Magento order will remain in Magento with the order status "canceled".



3. Canceling a paid Business Central sales order which is not shipped and invoiced

When customers pay for the order in advance, via a payment service provider, an invoice is automatically created in Magento. Therefore the Magento order will look slightly different since, on line level, the amounts are invoiced. These amounts need to be credited in order to be able to cancel the order.



Navigate to the Business Central sales order you want to delete and click Related > Magento > Cancel Magento Order.


This time the pop up that appears is different, it shows that it is not possible to cancel the order because the order has already been paid for by the customer and therefore an invoice in Magento already exists. In order to cancel the Magento order a credit memo has to be made to settle the existing invoice. Therefore an pop-up appears which asks to create an offline refund, click "Yes".



The notification bar informs that an offline refund has been created but that you are not able to delete the sales order yet. The offline refund is now send to Magento to settle the created invoice by the payment service provider. Note that the Magento Order Status is still showing "erp_processing".



When the Magento order is opened in the Magento Backend we now see that the order status is changed to "closed" and each order line contains a refunded quantity. The order in Magento is now closed and has an invoice and credit memo attached.



At this point of time it is important that the job queue "NC365 Get Sales Orders" is running (Object ID: 11260670). This is the same job queue that is importing the Magento orders. The job queue will update the Magento order status on the Business Central Sales order to "closed" as shown below.



Now that the order status is set to "closed" the Business Central sales order can be deleted. Go to Related > Magento > Cancel Order and click "Yes" to delete the Business Central sales order.



4. Canceling the remaining part of a partially shipped and invoiced sales order

In case the order is partially shipped and invoiced only the remaining quantity can be canceled. The sales order in Business Central for this example is shown below.



And this is what the same order looks like in Magento.



In order to cancel the remaining quantity of this order that has not been shipped and invoiced navigate to the Business Central sales order you want to cancel and click Related > Magento > Cancel Magento Order.



Canceling a partially shipped and invoiced order will return a Magento order status "complete".



The order in Magento will now show "canceled qty. 1" on the line that was open on the Business Central sales order.



Now that the Magento order is canceled the Business Central sales order can be deleted.



Cancelation statuses

In order to be able to delete a Business Central sales order the order status must be one of the statuses stated below.


CanceledThe entire order which is not shipped or invoiced is canceled
Complete
The remaining order lines of a partially shipped and invoiced order are canceled
Closed
The order is not shipped and invoiced and completely refunded