Customer types
Build the legacy customer-types table
/a/CustomerTypes_getDT
Return the legacy DataTables page of customer types, including counts and positional row arrays.
When to use this endpoint
Use CustomerTypes_getDT only for the CRM1 Customer Types table or a client that implements the same legacy DataTables 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 |
|---|---|---|---|
start | Integer string | Yes | Zero-based result offset after integer conversion. Negative values are not rejected. |
length | Integer string | Yes | SQL page length after integer conversion. The handler does not impose a maximum. |
order[0][column] | Integer string | Yes | Sort column: 0 selects id, 1 selects name, and every other value also selects name. |
order[0][dir] | String | Yes | Exact desc selects descending order; every other value selects ascending order. |
draw | Integer string | Yes | DataTables draw counter, returned after integer conversion. |
name | String | No | Nonblank case/collation-dependent substring filter on the type name. |
search[value] | String | No | Second nonblank substring filter on the name. When both filters are supplied, both must match. |
Example request
$page = FM_api('CustomerTypes_getDT', [
'start' => '0',
'length' => '25',
'order' => [['column' => '1', 'dir' => 'asc']],
'draw' => '4',
'search' => ['value' => 'com'],
]);
Example response
{
"sql": "select id, name, allowed_next, triggers, colour_hex from user123_customer_types where (name like \"%com%\") order by name asc limit 0,25",
"draw": 4,
"recordsTotal": "8",
"recordsFiltered": "1",
"data": [
["12", "Commercial", "12,13", "[]", "#336699", 0]
]
}
Each positional row is [id, name, allowed_next, triggers, colour_hex, 0]. The final zero is a legacy action-column 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. |
{"error":"missing or invalid parameter: length"} | length is absent. |
{"error":"missing or invalid parameter: [order][0][dir]"} | The nested direction key is absent. |
{"error":"missing or invalid parameter: [order][0][column]"} | The nested column key is absent. |
{"error":"missing or invalid parameter: draw"} | draw is absent. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
recordsTotalcounts every type;recordsFilteredapplies the same name filters as the page query.- The table has no deleted/status filtering. Trigger and transition values remain raw strings.
See it in Fieldmotion
CRM1
Open Settings → Customer Types. The legacy table sends this DataTables request.
CRM2
CRM2 uses CustomerTypes_getDataTable for its shared configurable table.
Related endpoints
CustomerTypes_getDataTableis the CRM2 table contract.CustomerType_getloads one raw row for editing.