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

ParameterTypeRequiredDescription
startInteger stringYesZero-based result offset after integer conversion. Negative values are not rejected.
lengthInteger stringYesSQL page length after integer conversion. The handler does not impose a maximum.
order[0][column]Integer stringYesSort column: 0 selects id, 1 selects name, and every other value also selects name.
order[0][dir]StringYesExact desc selects descending order; every other value selects ascending order.
drawInteger stringYesDataTables draw counter, returned after integer conversion.
nameStringNoNonblank case/collation-dependent substring filter on the type name.
search[value]StringNoSecond 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

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.
{"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

  • recordsTotal counts every type; recordsFiltered applies 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