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

ParameterTypeRequiredDescription
fieldsNative arrayYesRequested mapped names from id, name, categoryGroupId, and taxRate. Unknown fields are skipped and id is always included.
accountIDInteger-compatibleNoInner-join filter for categories linked from this account through manymany.type_num=1. Presence triggers the filter even when the value converts to 0.
isTableInteger-compatibleNoDefaults to table mode. Exact integer 0 returns only data and permits limit.
draw / start / lengthInteger-compatibleNoTable counter, zero-based offset, and page size; defaults are 0, 0, and 10. No maximum is enforced.
limitInteger-compatibleNoPositive limit for non-table mode. Zero or negative means unlimited.
orderBy / orderDescMapped field / directionNoExplicit 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 valuesNoFallback table ordering; the helper subtracts one for CRM2’s leading action column. Exact desc reverses the result.
searchValue / searchFieldString / mapped name(s)NoCase-insensitive substring search across all or selected mapped fields.
id / name / categoryGroupId / taxRateScalar or native arrayNoMapped filters. Name scalars use case-insensitive substring matching; numeric scalars use integer equality; arrays use IN and preserve fractional values for taxRate.
advanceSearch / groupByNative arraysNoShared 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

ResponseCondition
{"error":"missing or invalid parameter: fields"}fields is absent.
{"error":"error in database query"}The generated selection/filter/order query fails.
Runtime/type errorA 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 taxRate filter 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 recordsFiltered when accountID is 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