Search returns

distru-search-returnsRead

Searches returns (product a customer sent back, reversing inventory and financials) — header fields only; for one return's line items, use distru-get-return with includeReturnItems.

Inputs

Every tool also takes the common inputs.

FieldTypeRequiredDescription
limitintegerNoDefault: 10
cursorstringNonextCursor of the previous call; keep the other arguments unchanged.
customerIdsstring[]NoResolve via distru-search-companies.
orderIdsstring[]NoGeneric returns (no order) never match. Resolve via distru-search-sales-orders.
ownerIdsstring[]NoResolve via distru-search-users.
returnDateAfterstringNoInclusive. YYYY-MM-DD (start of day, company timezone) or ISO 8601 with a UTC offset.
returnDateBeforestringNoInclusive. YYYY-MM-DD (end of day, company timezone) or ISO 8601 with a UTC offset.
statusesenum[]
COMPLETEDPROCESSINGRECEIVEDSHIPPED
NoPROCESSING, SHIPPED and RECEIVED hold goods aside; COMPLETED restocks them except waste items.
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 RETURN_DATE DESC.
sortBy.directionenum
ASCDESC
Yes
sortBy.fieldenum
INSERTED_ATRETURN_DATERETURN_NUMBERSTATUSTOTAL
YesRETURN_DATE: undated returns sort last either direction.

Output

Presence on a nested field assumes its parent exists.

FieldTypePresence
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[].descriptionstringCan be null
items[].invoiceNumbersstring[]Always
items[].orderQuantitystringCan be null
items[].qbCreditMemoIdstringCan be null
items[].qbSyncStatusenum
DELETED_IN_QBOERRORNOT_SYNCEDPARTIALLY_SYNCEDPENDINGSYNCED
Can be null
items[].returnDatestringCan be null
items[].returnNumberstringAlways
items[].returnQuantitystringCan be null
items[].returnTypeenum
FULL_RETURNPARTIAL_RETURN
Can be null
items[].statusenum
COMPLETEDPROCESSINGRECEIVEDSHIPPED
Always
items[].totalnumberAlways
items[].companyobjectNull or absent
items[].company.idstringAlways
items[].company.namestringNull or absent
items[].locationobjectCan be null
items[].location.idstringAlways
items[].location.namestringAlways
items[].ownerobjectCan be null
items[].owner.idstringAlways
items[].owner.profileobjectAlways
items[].owner.profile.fullNamestringAlways
items[].salesOrderobjectCan be null
items[].salesOrder.idstringAlways
items[].salesOrder.orderNumberstringAlways
What the AI reads

Searches returns (product a customer sent back, reversing inventory and financials) — header fields only; for one return's line items, use distru-get-return with includeReturnItems. Generic returns have no sales order: salesOrder, orderQuantity, returnQuantity and returnType are null and invoiceNumbers is empty. qbCreditMemoId is the QuickBooks credit memo the return itself synced as. qbSyncStatus is null unless the company's QuickBooks module is on and connected, and while the company syncs credits to QuickBooks: the credit the return created then syncs instead and carries the credit memo, so qbCreditMemoId is set only if the return synced before that. PENDING and ERROR are its latest sync's outcome and win over the rest; NOT_SYNCED = it has no QuickBooks credit memo. For why a sync failed, use distru-search-quickbooks-activities with returnIds. Scoped to the returns the caller's team may see.