Skip to content

Order Life Cycle


Note

This page is under construction and may have incomplete or inaccurate information.

Overview

This page describes the typical order state sequence of a shedbuilder order. Shedbuilder orders come in three types: New, Inventory, and Stock. While the order state sequences of Inventory and Stock orders are linked, the order state sequence for New orders is independent of the other two. Some order states are only valid for one or two of the order types.

New Orders

Note

TODO

Inventory and Stock Orders

Inventory orders and stock orders are related, but represent slightly different things. An inventory order represents a shed, requested by a store or dealer, to be constructed and delivered to the store for the store to keep on its lot as an inventory item. A stock order represents an inventory shed that has been purchased by a customer. Therefore, all stock orders were initially inventory orders. The Inventory order state is shared between the inventory and stock order types, and it represents a constructed shed that is ready to be sold.

flowchart TD
    unsubmitted[Unsubmitted]
    submitted[Submitted]
    inProduction[In Production]
    pendingDelivery[Pending Delivery]
    inventoryPendingDelivery[Inventory Pending Delivery]
    inventory_Inventory[Inventory]
    pendingPayment[Pending Payment]
    inventorySold[Inventory Sold]
    canceled[Canceled]
    complete[Complete]
    productionOrderCreated([Production Order Created - manual task by JDM])

    idshipped{Needs to be shipped?}
    idpayment{Payment successful?}

    subgraph Inventory Order Type
      unsubmitted -->|Create Inventory|submitted
      submitted -->|Sales Order Created|productionOrderCreated
      productionOrderCreated-->inProduction
      inProduction -->|Production Order Finished|idshipped
      idshipped -->|Yes|pendingDelivery
      pendingDelivery -->|Transfer Order Created|inventory_Inventory
      idshipped -->|No|inventory_Inventory

      submitted -->|Canceled|canceled
    end
    subgraph Stock Order Type
      inventory_Inventory -->|Checkout|pendingPayment
      pendingPayment -->|Payment Processed|idpayment
      idpayment -->|Yes|inventorySold
      idpayment -->|No|inventory_Inventory
      inventorySold -->|Sales Order Released|inventoryPendingDelivery
      inventoryPendingDelivery -->|Sales Order Completed|complete
      inventoryPendingDelivery -->|Sales Order Deleted|complete

      inventorySold -->|Canceled|inventory_Inventory
      inventoryPendingDelivery -->|Canceled|inventory_Inventory
    end

Business Central will batch updates together before sending them to us. As a result, sometimes multiple updates on BC will happen before our system is notified. This can cause an issue when the last of those updates was deleting the record - most often a Sales Order. In this scenario, we are unable to process the earlier updates as the Sales Order has already been deleted by the time the we received a webhook payload. To avoid orders becoming stuck, we make assumptions when a Sales Order is deleted, regardless of what order state we have the order in. This can result in steps of the lifecycle being skipped - a rare event, but one that does happen from time to time. We do not make assumptions in the event of other BC record types being deleted.

  • For inventory orders, the order state is set to Inventory when the sales order is deleted
  • For stock orders, the order state is set to Complete when the sales order is deleted
  • For new shed orders, the order state is set to Complete when the sales order is deleted