Get a sales order

distru-get-sales-orderRead

Gets one sales order by ID: header detail, customer, owner, shipping and billing locations, menu, the compliance license stock was drawn from and the compliance manifest number.

Inputs

Every tool also takes the common inputs.

FieldTypeRequiredDescription
idstringYesResolve via distru-search-sales-orders.
includeInvoicesbooleanNoLinked invoice summaries.
includeOrderItemsbooleanNo
includeOrderItemCostItemsbooleanNocostItems on each line item; returns the line items even without includeOrderItems. costItems: the costs that make up the line item's cost, oldest first; null when none is recorded or the caller cannot view cost details. Costs carry over from inputs, so recordedOn can be an upstream package, batch, product, harvest, plant or plant batch rather than this line item; MULTIPLE_PLANTS is a cost split over several plants or plant batches, NONE one tied to no inventory. quantity is the share that went into this line item, out of costQuantity; both in unitType. totalCost is quantity × costPerUnit; both null when no cost per unit is recorded or the caller cannot see it. costType is null for purchase costs and costs Distru records itself; origin.purchaseOrder and origin.assembly are null when team restrictions hide them.
includeOrderItemPriceTiersbooleanNopriceTierMode and priceTier on each line item; returns the line items even without includeOrderItems. priceTier is the snapshot of the tier applied, null when none; isLive false when the tier was edited or deleted since. pricing applies value to priceBase (PERCENT_OFF: percent off, AMOUNT_OFF: subtracted, FLAT_PRICE: replaces it); price is the result. priceTierMode OVERRIDE: line locked to priceTier; NONE: takes no tier, keeps its own price; AUTO: no tier applied when the order was last saved.
includeOrderChargesbooleanNoCharges, discounts and taxes.
includeOriginalOrdersbooleanNoOrders merged into this one, when it is a combined order.

Output

Presence on a nested field assumes its parent exists.

FieldTypePresenceDescription
salesOrderobjectNull or absent
salesOrder.idstringAlways
salesOrder.customFieldsobject[]Always
salesOrder.customFields[].customFieldobjectAlways
salesOrder.customFields[].customField.idstringAlways
salesOrder.customFields[].customField.namestringAlways
salesOrder.customFields[].customField.fieldTypeenum
CHECKBOXDATEDROPDOWNTEXT
Always
salesOrder.customFields[].valuestringCan be null
salesOrder.orderNumberstringAlways
salesOrder.statusstringAlways
salesOrder.totalstringAlways
salesOrder.totalChargesstringAlways
salesOrder.totalReturnedstringAlways
salesOrder.orderDatestringAlways
salesOrder.dueDatestringAlways
salesOrder.deliveryDatestringCan be null
salesOrder.createdDatestringAlways
salesOrder.updatedDatestringAlways
salesOrder.externalNotesstringCan be null
salesOrder.urlstringAlways
salesOrder.coststringCan be null
salesOrder.revenuestringCan be null
salesOrder.customerobjectNull or absent
salesOrder.customer.idstringAlways
salesOrder.customer.namestringNull or absent
salesOrder.ownerobjectCan be null
salesOrder.owner.idstringAlways
salesOrder.owner.profileobjectAlways
salesOrder.owner.profile.fullNamestringAlways
salesOrder.locationobjectCan be null
salesOrder.location.idstringAlways
salesOrder.location.namestringAlways
salesOrder.location.addressstringAlways
salesOrder.shippingLocationobjectCan be null
salesOrder.shippingLocation.idstringAlways
salesOrder.shippingLocation.namestringAlways
salesOrder.shippingLocation.addressstringAlways
salesOrder.menuobjectCan be null
salesOrder.menu.idstringAlways
salesOrder.menu.namestringAlways
salesOrder.licenseobjectCan be null
salesOrder.license.idstringAlways
salesOrder.license.licenseNumberstringAlways
salesOrder.combinedOrderobjectCan be null
salesOrder.combinedOrder.idstringAlways
salesOrder.combinedOrder.orderNumberstringAlways
salesOrder.combinedOrder.statusstringAlways
salesOrder.originalOrdersobject[]Can be absent
salesOrder.originalOrders[].idstringAlways
salesOrder.originalOrders[].orderNumberstringAlways
salesOrder.originalOrders[].statusstringAlways
salesOrder.invoicesobject[]Can be absent
salesOrder.invoices[].idstringAlways
salesOrder.invoices[].invoiceNumberstringAlways
salesOrder.invoices[].paymentStatusenum
NOT_PAIDOVER_PAIDPAIDPARTIALLY_PAID
Always
salesOrder.invoices[].totalstringAlways
salesOrder.invoices[].paidstringAlways
salesOrder.invoices[].remainingAmountstringAlways
salesOrder.orderItemsobject[]Can be absent
salesOrder.orderItems[].idstringAlways
salesOrder.orderItems[].quantitystringAlways
salesOrder.orderItems[].pricestringAlways
salesOrder.orderItems[].priceBasestringAlways
salesOrder.orderItems[].isSamplebooleanAlways
salesOrder.orderItems[].notestringCan be null
salesOrder.orderItems[].coststringCan be null
salesOrder.orderItems[].revenuestringCan be null
salesOrder.orderItems[].productobjectAlways
salesOrder.orderItems[].product.idstringAlways
salesOrder.orderItems[].product.namestringAlways
salesOrder.orderItems[].product.unitTypeobjectAlways
salesOrder.orderItems[].product.unitType.idstringAlways
salesOrder.orderItems[].product.unitType.namestringAlways
salesOrder.orderItems[].batchobjectCan be null
salesOrder.orderItems[].batch.idstringAlways
salesOrder.orderItems[].batch.namestringAlways
salesOrder.orderItems[].locationobjectCan be null
salesOrder.orderItems[].location.idstringAlways
salesOrder.orderItems[].location.namestringAlways
salesOrder.orderItems[].packageobjectCan be null
salesOrder.orderItems[].package.idstringAlways
salesOrder.orderItems[].package.metrcLabelstringAlways
salesOrder.orderItems[].priceTierModeenum
AUTONONEOVERRIDE
Null or absent
salesOrder.orderItems[].costItemsobject[]Null or absent
salesOrder.orderItems[].costItems[].namestringAlways
salesOrder.orderItems[].costItems[].descriptionstringCan be null
salesOrder.orderItems[].costItems[].costTypeobjectCan be null
salesOrder.orderItems[].costItems[].costType.idstringAlways
salesOrder.orderItems[].costItems[].costType.namestringAlways
salesOrder.orderItems[].costItems[].createdByobjectCan be null
salesOrder.orderItems[].costItems[].createdBy.idstringAlways
salesOrder.orderItems[].costItems[].createdBy.fullNamestringAlways
salesOrder.orderItems[].costItems[].insertedAtstringAlways
salesOrder.orderItems[].costItems[].originobjectAlways
salesOrder.orderItems[].costItems[].origin.typeenum
ASSEMBLYBIOTRACK_ADJUSTMENTBIOTRACK_MANIFEST_RECEIVEDBREAKDOWNCOST_ENTRYMETRC_ADJUSTMENTMETRC_TRANSFER_RECEIVEDOTHERPACKAGE_IMPORTPLANT_BATCH_PACKAGINGPURCHASE_ORDERSTOCK_ADJUSTMENT
Always
salesOrder.orderItems[].costItems[].origin.purchaseOrderobjectCan be null
salesOrder.orderItems[].costItems[].origin.purchaseOrder.idstringAlways
salesOrder.orderItems[].costItems[].origin.purchaseOrder.purchaseNumberstringAlways
salesOrder.orderItems[].costItems[].origin.assemblyobjectCan be null
salesOrder.orderItems[].costItems[].origin.assembly.idstringAlways
salesOrder.orderItems[].costItems[].origin.assembly.numberstringAlways
salesOrder.orderItems[].costItems[].origin.breakdownobjectCan be null
salesOrder.orderItems[].costItems[].origin.breakdown.breakdownNumberstringCan be null
salesOrder.orderItems[].costItems[].recordedOnobjectAlways
salesOrder.orderItems[].costItems[].recordedOn.typeenum
PACKAGEBATCHPRODUCTHARVESTPLANTPLANT_BATCHMULTIPLE_PLANTSNONE
Always
salesOrder.orderItems[].costItems[].recordedOn.productobjectCan be null
salesOrder.orderItems[].costItems[].recordedOn.product.idstringAlways
salesOrder.orderItems[].costItems[].recordedOn.product.namestringAlways
salesOrder.orderItems[].costItems[].recordedOn.product.skustringAlways
salesOrder.orderItems[].costItems[].recordedOn.packageobjectCan be null
salesOrder.orderItems[].costItems[].recordedOn.package.idstringAlways
salesOrder.orderItems[].costItems[].recordedOn.package.metrcLabelstringAlways
salesOrder.orderItems[].costItems[].recordedOn.batchobjectCan be null
salesOrder.orderItems[].costItems[].recordedOn.batch.idstringAlways
salesOrder.orderItems[].costItems[].recordedOn.batch.namestringAlways
salesOrder.orderItems[].costItems[].recordedOn.harvestobjectCan be null
salesOrder.orderItems[].costItems[].recordedOn.harvest.namestringAlways
salesOrder.orderItems[].costItems[].recordedOn.plantobjectCan be null
salesOrder.orderItems[].costItems[].recordedOn.plant.labelstringCan be null
salesOrder.orderItems[].costItems[].recordedOn.plant.strainNamestringCan be null
salesOrder.orderItems[].costItems[].recordedOn.plantBatchobjectCan be null
salesOrder.orderItems[].costItems[].recordedOn.plantBatch.namestringAlways
salesOrder.orderItems[].costItems[].recordedOn.plantBatch.strainNamestringCan be null
salesOrder.orderItems[].costItems[].recordedOn.multiplePlantsobjectCan be null
salesOrder.orderItems[].costItems[].recordedOn.multiplePlants.summarystringAlways
salesOrder.orderItems[].costItems[].recordedOn.multiplePlants.detailsstringAlways
salesOrder.orderItems[].costItems[].quantitystringAlways
salesOrder.orderItems[].costItems[].costQuantitystringAlways
salesOrder.orderItems[].costItems[].unitTypeobjectAlways
salesOrder.orderItems[].costItems[].unitType.idstringAlways
salesOrder.orderItems[].costItems[].unitType.namestringAlways
salesOrder.orderItems[].costItems[].costPerUnitstringCan be null
salesOrder.orderItems[].costItems[].totalCoststringCan be null
salesOrder.orderItems[].priceTierobjectNull or absent
salesOrder.orderItems[].priceTier.idstringAlways
salesOrder.orderItems[].priceTier.namestringAlways
salesOrder.orderItems[].priceTier.pricingobjectAlways
salesOrder.orderItems[].priceTier.pricing.typeenum
AMOUNT_OFFFLAT_PRICEPERCENT_OFF
Always
salesOrder.orderItems[].priceTier.pricing.valuestringCan be null
salesOrder.orderItems[].priceTier.isLivebooleanAlways
salesOrder.orderChargesobject[]Can be absent
salesOrder.orderCharges[].idstringAlways
salesOrder.orderCharges[].namestringAlways
salesOrder.orderCharges[].typestringAlways
salesOrder.orderCharges[].unitTypestringAlways
salesOrder.orderCharges[].percentstringCan be null
salesOrder.orderCharges[].pricestringAlways
salesOrder.orderCharges[].isTaxbooleanAlways
salesOrder.complianceManifestNumberstringCan be nullManifest number of the matched compliance transfer; null when unmatched.
What the AI reads

Gets one sales order by ID: header detail, customer, owner, shipping and billing locations, menu, the compliance license stock was drawn from and the compliance manifest number. Line items, charges and linked invoices are left out unless you pass includeOrderItems, includeOrderCharges or includeInvoices; includeOrderItemCostItems and includeOrderItemPriceTiers add each line's cost breakdown and price tier. Use for a specific order after resolving its ID via distru-search-sales-orders or distru-report-sales-orders; to browse orders use distru-search-sales-orders, for invoice line items and charges use distru-get-invoice, and for price tiers applied across many orders distru-report-sales-orders with rowsPer LINE_ITEM. cost is null unless the caller may view costs; revenue is not permission-gated and is null until the order has fulfilled stock, so a null there means nothing has shipped, not that access was denied. Line item cost and revenue follow the same rules; the order cost can leave out sample lines (a company setting), so line costs may not add up to it. Line quantity and price are in product.unitType. status is a human-readable string and does not match the SalesOrderStatus enum casing. combinedOrder is the order this one was merged into. Null if no order matches the ID; a permission error if the caller can't view it.