Task types
Query the mapped Task Types table
/a/TaskTypes_getDataTable
Page, search, filter, and sort task types through CRM2’s mapped data-table engine.
When to use this endpoint
Use TaskTypes_getDataTable when reproducing CRM2’s Task Types settings table. Use TaskTypes_list for a simple picker.
Authentication and permissions
The request must establish an authenticated tenant context with signed API credentials or a logged-in CRM session. This legacy handler checks or immediately uses the tenant database prefix rather than calling the normal login guard.
It performs no additional Settings-page, role, create, edit, or delete permission check.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
fields | Native array | Yes | Requested mapped keys: id, name, cDate, and/or lastEdited. Unknown names are skipped and id is always added. |
isTable | Integer string | No | Defaults to table mode. Integer 0 returns only data and enables optional limit. |
draw / start / length | Integer strings | No | Table draw counter, row offset, and page size; defaults are 0, 0, and 10. |
limit | Integer string | No | Positive non-table row limit. Zero means unbounded. |
orderBy / orderDesc | Mapped field / direction | No | Explicit mapped sorting. Field matching has a case-insensitive fallback. |
order[0][column] / order[0][dir] | DataTables values | No | Positional fallback sorting; the engine subtracts one for the leading action column. |
searchValue / searchField | String / string or array | No | Case-insensitive substring search across one mapped field or All. |
name / cDate / lastEdited / id | Scalar or native array | No | Direct mapped filters. Text scalars use case-insensitive substring matching; integer ID uses equality; arrays use IN. |
referenceDate / dateFrom / dateTo | Mapped field / integer day offsets | No | Shared inclusive relative-date window in the tenant timezone. |
advanceSearch / groupBy | Native arrays | No | Shared mapped condition objects and grouping fields used by CRM2’s table widget. |
Example request
$table = FM_api('TaskTypes_getDataTable', [
'fields' => ['id', 'name', 'cDate'],
'draw' => '2',
'start' => '0',
'length' => '25',
'orderBy' => 'name',
'orderDesc' => 'asc',
]);
Example response
{
"data": [
{"id": "3", "name": "Customer follow-up", "cDate": "2026-09-28 09:15:00"}
],
"draw": 2,
"recordsTotal": "12",
"recordsFiltered": "12"
}
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: fields"} | fields is absent. |
{"error":"error in database query"} | A generated mapped/filter/pagination query fails. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Task types have no deleted state, so totals include every stored row. No Settings-page or role filter is applied by this route.
- Table mode returns
data, integerdraw, and database scalar counts. Non-table mode omits count metadata. - Without explicit sorting, the first requested mapped field is used through the shared table convention; do not treat that default as a stable integration order.
See it in Fieldmotion
CRM1
No direct CRM1 caller was found; CRM1 uses TaskTypes_list.
CRM2
Open Settings → Task Types. CRM2’s shared data widget derives the mapped create, detail, update, single-field update, and table routes from the TaskType/TaskTypes prefixes.
Related endpoints
TaskType_getRequestedDetailsreturns an unpaged mapped list without count metadata.TaskType_updateDatais the table widget’s mapped update route.