Search purchase orders

distru-search-purchase-ordersRead

Searches purchase orders (purchases from suppliers) — one row per purchase, 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[]NoAny line item of these batches. Resolve via distru-search-batches.
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[]NoDrafts need status DRAFT.
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[]NoResolve via distru-search-users.
paymentStatusenum[]
NOT_PAIDOVER_PAIDPAIDPARTIALLY_PAID
No
productIdsstring[]NoAny line item of these products. Resolve via distru-search-products.
searchstringNoCase-insensitive substring of purchase number or matched compliance manifest number (manifest only for 4+ char terms). Ranked by purchase number similarity; sortBy ignored. Drafts need status DRAFT.
statusenum[]
COMPLETEDDELIVERINGDRAFTPARTIALLY_RECEIVEDPENDINGPROCESSING
NoDefaults to every status but DRAFT: drafts come back only when this includes DRAFT.
supplierIdsstring[]NoResolve via distru-search-companies.
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. Ignored when search is set.
sortBy.directionenum
ASCDESC
Yes
sortBy.fieldenum
DUE_DATEINSERTED_ATORDER_DATEPURCHASE_NUMBERUPDATED_AT
YesDUE_DATE = payment due date. Purchases without the sorted date sort last either direction.

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[].purchaseNumberstringAlways
items[].statusenum
COMPLETEDDELIVERINGDRAFTPARTIALLY_RECEIVEDPENDINGPROCESSING
Always
items[].paymentStatusenum
NOT_PAIDOVER_PAIDPAIDPARTIALLY_PAID
Always
items[].totalstringAlways
items[].totalChargesstringAlways
items[].orderDatestringCan be null
items[].dueDatestringCan be null
items[].createdDatestringAlways
items[].updatedDatestringAlways
items[].urlstringAlways
items[].qbBillIdstringCan be null
items[].qbSyncStatusenum
DELETED_IN_QBOERRORNOT_SYNCEDPARTIALLY_SYNCEDPENDINGSYNCED
Can be null
items[].supplierobjectNull or absent
items[].supplier.idstringAlways
items[].supplier.namestringNull or absent
items[].intakeLocationobjectCan be null
items[].intakeLocation.idstringAlways
items[].intakeLocation.namestringAlways
items[].ownerobjectCan be null
items[].owner.idstringAlways
items[].owner.profileobjectAlways
items[].owner.profile.fullNamestringAlways
items[].complianceManifestNumberstringCan be nullManifest number of the matched compliance transfer; null when unmatched.
What the AI reads

Searches purchase orders (purchases from suppliers) — one row per purchase, not line items. For one purchase's line items, charges and payments, use distru-get-purchase-order (includePayments for payments); for payments across purchases, distru-search-purchase-payments; for a flattened report with CSV-style filters, distru-report-purchase-order-history. intakeLocation is the location the inventory is received into. complianceManifestNumber is the matched compliance manifest number, null when unmatched. A DRAFT may lack supplier, intakeLocation and dates. qbBillId is its QuickBooks bill ID. qbSyncStatus is null unless the company's QuickBooks module is on and connected; PENDING and ERROR are its latest sync's outcome and win over the rest; DELETED_IN_QBO = the bill was deleted in QuickBooks; NOT_SYNCED = it has no QuickBooks bill. Bill payment syncs don't count. qbSyncStatus ERROR: distru-search-quickbooks-activities with purchaseOrderIds gives the error. ERROR or NOT_SYNCED: distru-sync-to-quickbooks pushes it, or says why it can't.