What order should I load 'Sales Order' related objects
When bulk loading Sale Orders from legacy systems, you should load related objects in this order.
Step-by-step guide
Sales Order
Sales Order Line
Sales Order (update, set to closed if they have an invoice)
Receipts
Receipt Lines
Query for any invoice lines
Receipt Lines tied to Invoice lines (has the invoice line id from prior query)
Sales Order (update and set to closed)
Receipt (update and set to posted)
Sales Order (set to posted)
Resulting System Created records from posting Sales Order
Subscription
Subscription lines
Subscription Terms