When to use this endpoint

Use CustomerTypes_getDataTable for CRM2’s configurable Customer Types list or another client implementing the shared table-query 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
fieldsNative arrayYesMapped output fields selected from id, name, allowedNext, triggers, lastEdited, and colourHex. Unknown names are ignored and id is always returned.
isTableInteger stringNoDefaults to table mode. Exact integer 0 returns only data and permits optional limit.
draw / start / lengthInteger stringsNoTable counter, zero-based offset, and page size; defaults are 0, 0, and 10. No endpoint-specific maximum is imposed.
limitInteger stringNoPositive non-table maximum; zero means unlimited.
orderBy / orderDescMapped name / directionNoExplicit sort pair. Field lookup falls back case-insensitively, then to a requested mapped field.
order[0][column] / order[0][dir]DataTables valuesNoFallback ordering. The shared engine subtracts one from the column position for CRM2’s leading action column; exact desc reverses the result.
searchValue / searchFieldString / mapped name or native arrayNoCase-insensitive substring search over selected mapped fields; omitted field means all map fields.
Mapped field filtersScalar or native arrayNoSupply id, name, allowedNext, triggers, lastEdited, or colourHex. Text scalars use case-insensitive substring matching, integers equality, and arrays IN.
referenceDate / dateFrom / dateTo / offsetsShared date-filter valuesNoInclusive relative-date filtering is available with referenceDate=lastEdited, based on today in the tenant timezone.
advanceSearch / groupByNative arraysNoCRM2 advanced conditions and mapped grouping. Unknown field names are ignored.

Example request

$page = FM_api('CustomerTypes_getDataTable', [
	'fields' => ['id', 'name', 'colourHex'],
	'start' => '0',
	'length' => '25',
	'draw' => '1',
]);

Example response

{
  "data": [
    {"id": "12", "name": "Commercial", "colourHex": "#336699"}
  ],
  "draw": 1,
  "recordsTotal": "8",
  "recordsFiltered": "8"
}

The shared helper can also return a non-DataTables result shape when called without table paging/draw options. Match the calling mode used by your client.

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: fields"}fields is absent.
{"error":"error in database query"}A mapped/filter query fails.
Runtime warning or type errorfields or another shared array option is supplied in a malformed scalar shape.

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

Behaviour and edge cases

  • Field names and response keys are camel-case mapped names. Trigger and allowed-next text is not decoded.
  • Table mode returns paged data, integer draw, and scalar database counts. Non-table mode omits table metadata and is unlimited unless limit is positive.
  • The customer-types table has no deleted column, so no active/deleted filter is applied. The tenant timezone matters only to relative date filtering.
  • Search, mapped filters, ordering, grouping, advanced filters, and pagination are implemented by the common table helper rather than endpoint-specific code.

See it in Fieldmotion

CRM1

CRM1 uses the older CustomerTypes_getDT positional-row table.

CRM2

Open Settings → Customer Types. The shared display widget derives this endpoint for the list query.

Related endpoints