Accounts and tax types
Query the mapped Tax Types table
/a/AccountCategories_getDataTable
Query tax types through CRM2’s mapped field, filter, search, ordering, and paging helper.
When to use this endpoint
Use AccountCategories_getDataTable for CRM2’s generic Tax Type picker when a paged searchable result is required.
Authentication and permissions
The API request must establish a logged-in tenant context. This handler has no explicit login or tenant-prefix check; it immediately builds a tenant query from the current session.
It performs no Finance-page, client-admin, role, or data permission check. Do not treat the PHP handler as an authorization boundary.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
fields | Native array | Yes | Requested mapped names from id, name, categoryGroupId, and taxRate. Unknown fields are skipped and id is always included. |
accountID | Integer-compatible | No | Inner-join filter for categories linked from this account through manymany.type_num=1. Presence triggers the filter even when the value converts to 0. |
isTable | Integer-compatible | No | Defaults to table mode. Exact integer 0 returns only data and permits limit. |
draw / start / length | Integer-compatible | No | Table counter, zero-based offset, and page size; defaults are 0, 0, and 10. No maximum is enforced. |
limit | Integer-compatible | No | Positive limit for non-table mode. Zero or negative means unlimited. |
orderBy / orderDesc | Mapped field / direction | No | Explicit named order. Field matching falls back case-insensitively, then to a requested mapped field. The direction is trusted internal input and not normalized. |
order[0][column] / order[0][dir] | DataTables values | No | Fallback table ordering; the helper subtracts one for CRM2’s leading action column. Exact desc reverses the result. |
searchValue / searchField | String / mapped name(s) | No | Case-insensitive substring search across all or selected mapped fields. |
id / name / categoryGroupId / taxRate | Scalar or native array | No | Mapped filters. Name scalars use case-insensitive substring matching; numeric scalars use integer equality; arrays use IN and preserve fractional values for taxRate. |
advanceSearch / groupBy | Native arrays | No | Shared CRM2 condition objects and mapped grouping controls. |
Example request
$page = FM_api('AccountCategories_getDataTable', [
'fields' => ['id', 'name', 'taxRate', 'categoryGroupId'],
'searchValue' => 'VAT',
'start' => 0,
'length' => 25,
'draw' => 4,
'orderBy' => 'name',
'orderDesc' => 'asc',
]);
Example response
{
"data": [
{"id":"271006","name":"Standard VAT","taxRate":"20","categoryGroupId":"151003"}
],
"draw":4,
"recordsTotal":"12",
"recordsFiltered":"2"
}
Errors and unusual responses
| Response | Condition |
|---|---|
{"error":"missing or invalid parameter: fields"} | fields is absent. |
{"error":"error in database query"} | The generated selection/filter/order query fails. |
Runtime/type error | A list parameter such as fields is supplied in an unsupported scalar/JSON-string 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
- Categories have no soft-delete flag, so every stored row is eligible.
- Table mode returns total and filtered tenant counts. Non-table mode returns only
data. - A scalar fractional
taxRatefilter is integer-converted by the shared helper; use an array filter or advanced condition when an exact fractional rate matters. - Duplicate account/category links can duplicate rows and inflate
recordsFilteredwhenaccountIDis supplied.
See it in Fieldmotion
CRM1
No direct CRM1 caller was found. CRM1 uses fixed list endpoints for category selectors.
CRM2
Open a generic picker for a Tax Type field, search or page the list, and filter developer tools for AccountCategories_getDataTable.
Related endpoints
AccountCategory_getRequestedDetailsreturns unpaged exact-filter details with an explicit login guard.AccountCategories_listis the narrow fixed list.