Customer types
List customer types
/a/CustomerTypes_list
List customer types by optional IDs or edit window, with an allowlisted raw-column projection.
When to use this endpoint
Use CustomerTypes_list for sorted choices, exports, or incremental reads that need raw customer-type column names.
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 |
|---|---|---|---|
ids | JSON array string | No | Optional ID filter. It is applied only when the encoded string is longer than two characters; a native array is not supported. |
fields | JSON array string or native array | No | Unique columns selected from id, name, allowed_next, last_edited, and colour_hex. Invalid or empty selection defaults to id, name, and colour_hex. triggers is unavailable. |
last_edited | Datetime string | No | Returns rows with last_edited strictly later than this value and strictly earlier than the current server time. The input is not date-validated. |
Example request
$types = FM_api('CustomerTypes_list', [
'ids' => json_encode([12, 13]),
'fields' => ['id', 'name', 'allowed_next', 'colour_hex'],
]);
Example response
[
{"id": "12", "name": "Commercial", "allowed_next": "12,13", "colour_hex": "#336699"},
{"id": "13", "name": "Residential", "allowed_next": "", "colour_hex": "#669933"}
]
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. |
PHP type/error response rather than a stable API error | ids is sent as a native array, or a longer malformed JSON value is decoded and then used as an array. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Rows are ordered by name using the tenant database collation. There is no pagination or maximum row count.
- When both filters are present they are combined with AND. The upper edit-window bound is captured from current server time.
- The table has no deleted/status column, and no tenant setting changes the result.
See it in Fieldmotion
CRM1
Customer forms and exports use this endpoint for type choices and selected raw columns.
CRM2
CRM2 customer and reporting screens use this list where a lightweight sorted choice set is sufficient.
Related endpoints
CustomerTypes_listByDepartmentapplies department and transition restrictions.CustomerTypes_getByIdsupports trigger text for explicit IDs.