Supply Lens

Follow an order into Unleashed

Lesson 8 of 24 7 min read

What happens, step by step, when Supply Lens sends an order to Unleashed, and what happens later when it is fulfilled or cancelled.

When an order looks wrong in Unleashed, it helps enormously to know the order in which things happened: was the customer found, was a contact matched, was the status checked? This lesson follows one order from a sales channel into Unleashed and on through fulfilment, so you can picture where each setting acts.

The end-to-end picture

Rendering diagram...

Three phases of sending an order

Supply Lens sends an order to Unleashed in three phases. Only two calls happen for every order: finding the customer and sending the order. Everything else depends on a setting or on the data.

1. Before the order

  • Look-ups. If the settings ask for it, Supply Lens reads Unleashed's tax rates (to match the nearest rate), salespeople, or the customer's default salesperson.
  • Find the customer, by code, by name or by email address, depending on your settings. This always happens.
  • Create the customer first, if needed. If the customer does not exist and the order should create one, Supply Lens creates it before the order. A new customer is given the order's currency, because Unleashed refuses an order whose currency differs from its customer's.
  • Check the status. With validateOrderStatuses on (the default), Supply Lens reads your account's sales order statuses once per run and checks the order's status is one of them.
  • Delivery contact. If you use delivery contacts, Supply Lens reads the customer's contacts, matches one, and can create a contact and give it an address. The advanced module covers this in detail.

2. The order

  • Send the sales order with everything worked out in phase 1.
  • Complete or delete. If the Document is already fulfilled, Supply Lens completes the order in Unleashed. If it is cancelled, Supply Lens deletes it. These follow completeFulfilledOrders and deleteCancelledOrders.

3. After the order

  • Update the customer, if it still needs writing and was not created in phase 1.
  • Assemblies. If the order created assembly orders, Supply Lens can complete them (autoCompleteAssemblies).
  • Sales shipment. If createSalesShipment is on, Supply Lens creates the shipment too.

Why the customer comes first

Unleashed added delivery contacts to sales orders. A contact belongs to a customer, so the customer must exist before the order can name its contact, and Unleashed will not let an order be changed afterwards to add one. Creating the customer first does not add an extra call: the customer write that used to happen after the order now happens before it.

An order is only sent once

If a Document already carries an Unleashed identifier, nothing at all is sent. Supply Lens also protects against duplicates when you reprocess: if Target Data with the same reference already exists, the new one is marked Cancelled instead of being sent again. That means you can safely reprocess a batch of Documents while testing.

When the order is fulfilled or cancelled

After the order is in Unleashed, two settings decide how changes at the source are reflected:

completeFulfilledOrdersOn by default. When an order is fully fulfilled, it is marked Completed in Unleashed. Turn it off if your team completes orders in Unleashed by hand.
deleteCancelledOrdersOn by default. When an order is cancelled in the source system, it is deleted from Unleashed. Turn it off if cancellations need a person to check them first.

Tracing a Hilltop order

Order #1047 from a new Shopify customer arrives. Supply Lens searches Unleashed by customer code and finds nothing, so it creates the customer in GBP. It checks Placed against Hilltop's statuses, sends the sales order, and stops: the order is not yet fulfilled. Two days later, Hilltop's team dispatches it in Unleashed. Supply Lens receives the shipment, sends tracking to Shopify, and because the order is now fully fulfilled, completes it in Unleashed.

Recap

  • Every order involves at least two calls: find the customer and send the order.
  • New customers are created before the order, in the order's currency, so delivery contacts can be attached.
  • The order's status is checked against your Unleashed statuses before sending, unless you turn that off.
  • Fulfilled orders are completed and cancelled orders deleted in Unleashed by default.
  • A Document already carrying an Unleashed identifier is never sent again, and reprocessing is protected against duplicates.

Quick guides for this topic

Complete and continue

Your progress is saved in this browser. Create a free account to keep it everywhere, take quizzes and earn certificates.