Customers
List customer purchase and requisition orders
/a/Customer_ordersGetDT
Combine requisition and purchase orders linked to a customer, the customer’s quotes, or the customer’s jobs for the CRM1 Orders panel.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
customer_id | Integer string | Consumed | Customer ID. The implementation reads it without an explicit presence or positive-value check; omitted or non-numeric input becomes 0. |
start | Integer string | Yes | Zero-based offset applied separately to requisition orders and purchase orders. Only presence is validated. |
length | Integer string | Consumed | Limit applied separately to each order table. It is read without explicit validation. |
draw | Integer string | No | DataTables counter copied to the response; defaults to 0. |
order[0][column] | Integer string | Consumed | Read by the handler, but every value sorts each source table by creation date. |
order[0][dir] | String | No | Exact desc selects descending order; all other values select ascending order. |
search[value] | String | Consumed | Case-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
| Response | Condition |
|---|---|
{"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 defaults | Other 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_idmatches. The meeting branch does not also constraincustomer_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
Customer_quotesGetDTlists the customer quotes through which some orders are associated.- The customer Jobs data-table endpoint lists jobs through which some orders are associated.