Search sales orders

distru-search-sales-ordersRead

Searches sales orders — one row per order, not line items.

Inputs

Every tool also takes the common inputs.

FieldTypeRequiredDescription
limitintegerNoDefault: 10
cursorstringNonextCursor of the previous call; keep the other arguments unchanged.
batchIdsstring[]NoLine items filled by these batches. Resolve via distru-search-batches.
customerIdsstring[]NoResolve via distru-search-companies.
deliveryDateAfterstringNoInclusive. YYYY-MM-DD (start of day, company timezone) or ISO 8601 with a UTC offset.
deliveryDateBeforestringNoInclusive. YYYY-MM-DD (end of day, company timezone) or ISO 8601 with a UTC offset.
dueDateAfterstringNoPayment due date, inclusive. YYYY-MM-DD (start of day, company timezone) or ISO 8601 with a UTC offset.
dueDateBeforestringNoPayment due date, inclusive. YYYY-MM-DD (end of day, company timezone) or ISO 8601 with a UTC offset.
idsstring[]No
menuIdsstring[]NoMenus the orders were placed from. Resolve via distru-search-menus.
orderDateAfterstringNoInclusive. YYYY-MM-DD (start of day, company timezone) or ISO 8601 with a UTC offset.
orderDateBeforestringNoInclusive. YYYY-MM-DD (end of day, company timezone) or ISO 8601 with a UTC offset.
ownerIdsstring[]NoSales rep. Resolve via distru-search-users.
paymentStatusenum[]
NOT_PAIDOVERPAIDPAIDPAYING
No
productIdsstring[]NoAny line item of these products. Resolve via distru-search-products.
taxIdsstring[]NoAny of these taxes. Resolve via distru-search-lookups (type TAX).
searchstringNoCase-insensitive substring of order number, customer name, LeafLink short ID or matched compliance manifest number (manifest only for 4+ char terms). Ranked by order number similarity; sortBy ignored.
statusenum[]
CANCELEDCOMPLETEDDELIVEREDDELIVERINGMERGEDPENDINGPROCESSINGREADY_TO_SHIP
No
totalGreaterThanOrEqualTonumberNoDollars.
totalLessThanOrEqualTonumberNoDollars.
customFieldsobject[]NoSet one of contains, anyOf or onOrAfter/onOrBefore per entry. Records with no value for the field never match.
customFields[].customFieldIdstringYesResolve via distru-search-custom-fields.
customFields[].containsstringNoTEXT: case-insensitive substring.
customFields[].anyOfstring[]NoDROPDOWN, CHECKBOX: any of these options, case-sensitive.
customFields[].onOrAfterstringNoDATE: YYYY-MM-DD, company timezone.
customFields[].onOrBeforestringNoDATE: YYYY-MM-DD, company timezone.
sortByobjectNoDefault UPDATED_AT DESC; DUE_DATE is the payment due date. Ignored when search is set.
sortBy.directionenum
ASCDESC
Yes
sortBy.fieldenum
DUE_DATEINSERTED_ATORDER_DATEORDER_NUMBERTOTALUPDATED_AT
Yes

Output

Presence on a nested field assumes its parent exists.

FieldTypePresenceDescription
hasMorebooleanAlways
nextCursorstringCan be absent
totalCountintegerCan be absent
itemsobject[]Always
items[].idstringAlways
items[].customFieldsobject[]Always
items[].customFields[].customFieldobjectAlways
items[].customFields[].customField.idstringAlways
items[].customFields[].customField.namestringAlways
items[].customFields[].customField.fieldTypeenum
CHECKBOXDATEDROPDOWNTEXT
Always
items[].customFields[].valuestringCan be null
items[].orderNumberstringAlways
items[].statusstringAlways
items[].totalstringAlways
items[].totalChargesstringAlways
items[].totalReturnedstringAlways
items[].orderDatestringAlways
items[].dueDatestringAlways
items[].deliveryDatestringCan be null
items[].createdDatestringAlways
items[].updatedDatestringAlways
items[].urlstringAlways
items[].customerobjectNull or absent
items[].customer.idstringAlways
items[].customer.namestringNull or absent
items[].ownerobjectCan be null
items[].owner.idstringAlways
items[].owner.profileobjectAlways
items[].owner.profile.fullNamestringAlways
items[].locationobjectCan be null
items[].location.idstringAlways
items[].location.namestringAlways
items[].complianceManifestNumberstringCan be nullManifest number of the matched compliance transfer; null when unmatched.
What the AI reads

Searches sales orders — one row per order, not line items. Use it to find a customer or owner from an order, or to check order status and totals live. For one order's line items and charges, use distru-get-sales-order; for a flattened report with revenue/source breakdowns, distru-report-sales-orders with rowsPer ORDER; for line items across orders, the same report with rowsPer LINE_ITEM. complianceManifestNumber is the matched compliance manifest number, null when unmatched. The returned status is a human-readable string (e.g. "Ready to ship") that does not match the casing of the status filter enum — do not compare them directly.