When to use this endpoint

Use Customer_ordersGetDT only when reproducing the legacy customer Orders table. It combines two order tables into one positional response.

Treat its counts and page boundaries as presentation compatibility values rather than a reliable cross-order export contract.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session. The handler performs no additional page or role-permission check.

The lookup and any write use the authenticated tenant; an ID from another tenant cannot be addressed through this call.

Parameters

ParameterTypeRequiredDescription
customer_idInteger stringConsumedCustomer ID. The implementation reads it without an explicit presence or positive-value check; omitted or non-numeric input becomes 0.
startInteger stringYesZero-based offset applied separately to requisition orders and purchase orders. Only presence is validated.
lengthInteger stringConsumedLimit applied separately to each order table. It is read without explicit validation.
drawInteger stringNoDataTables counter copied to the response; defaults to 0.
order[0][column]Integer stringConsumedRead by the handler, but every value sorts each source table by creation date.
order[0][dir]StringNoExact desc selects descending order; all other values select ascending order.
search[value]StringConsumedCase-insensitive substring match against delivery date or the stored reference column in each order table. Requisition descriptions are displayed but are not searched.

Example request

$orders = FM_api('Customer_ordersGetDT', [
	'customer_id' => '1088',
	'start' => '0',
	'length' => '20',
	'draw' => '4',
	'order' => [['column' => '0', 'dir' => 'desc']],
	'search' => ['value' => 'PO-2026'],
]);

Example response

{
  "draw": 4,
  "recordsTotal": 2,
  "recordsFiltered": 2,
  "data": [
    ["Requisition Order", "48", "2026-09-20 12:10:00", "Urgent parts", 125.5, "Open", "-", "", ""],
    ["Purchase Order", "91", "2026-09-21 09:05:00", "PO-2026-091", 275, "Complete", "Customer", "2026-09-21 10:00:00", ""]
  ]
}

Each positional row contains order type, order ID, creation date, description/reference, numeric net total, status label, target-type label, purchase-order sent date, and a blank action placeholder.

Errors and unusual responses

ResponseCondition
{"error":"not logged in"}No authenticated tenant context is available. Invalid signed credentials can be rejected by the dispatcher before the handler runs.
{"error":"missing or invalid parameter: start"}start is absent.
Runtime warning or coerced defaultsOther DataTables fields are absent; the handler reads several nested values without validating them. Send the complete request shape shown above.

Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.

Behaviour and edge cases

  • Non-deleted orders are included when their target is the customer, a non-deleted quote belonging to the customer, or a non-deleted meeting whose numeric customer_id matches. The meeting branch does not also constrain customer_type.
  • Requisition and purchase orders are sorted independently. The merged response is not globally ordered by creation date.
  • Status indexes map to Open, Part Received, Complete, Over-Received, and Cancelled. Target indexes map to -, Contract, Customer, Quote, Job, Department, and Location.
  • The requisition-order projection does not select target_type, so requisition rows always use the fallback target label - even when they were linked through another target type.
  • The handler does not verify customer existence. No matches return zero counts and an empty data array.

See it in Fieldmotion

CRM1

Open a customer and select Orders. Filter Network requests for Customer_ordersGetDT. CRM1 exposes this tab only when the employer feature bit 262144 is enabled; the endpoint itself does not repeat that feature check.

CRM2

A source search found no CRM2 caller for this legacy combined Orders-table endpoint.

Related endpoints