When to use this endpoint

Use JobTypes_getDataTable for CRM2-style configurable tables or a named-field query. Use JobTypes_getDT only when the legacy positional table contract is required.

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 arrayYesRequested mapped keys: id, name, priority, lastEdited, notes, meta, archived, nominalCode, taxSettings, department, metaFormID, metaSendNotification, metaNotificationEmail, and metaOrderNum. Unknown keys are ignored and id is always returned.
isTableInteger stringNoDefaults to table mode. Exact integer 0 returns only data and enables the optional limit.
draw / start / lengthInteger stringsNoTable counter, offset, and page size; defaults are 0, 0, and 10. No endpoint-specific maximum is imposed.
limitInteger stringNoPositive maximum in non-table mode. Zero or a negative value means unlimited.
orderBy / orderDescMapped name / directionNoExplicit ordering. Field lookup falls back case-insensitively and then to a requested mapped key. orderDesc is inserted without normalization.
order[0][column] / order[0][dir]DataTables valuesNoFallback table order. The shared helper subtracts one from the column index for CRM2’s action column; exact desc reverses the result.
searchValue / searchFieldString / mapped name or native arrayNoCase-insensitive substring search over selected map fields. Omitted searchField searches all mapped fields.
Mapped field filtersScalar or native arrayNoSupply any mapped key. Text scalars use case-insensitive substrings, numeric scalars equality, and arrays IN. Metadata subfields address their JSON paths.
referenceDate / dateFrom / dateTo / offsetsShared date-filter valuesNoInclusive relative dates use today in the tenant timezone. lastEdited is the meaningful date map entry.
advanceSearch / groupByNative arraysNoCRM2 advanced conditions and mapped grouping. Unknown mapped names are ignored.

Example request

$page = FM_api('JobTypes_getDataTable', [
	'fields' => ['id', 'name', 'priority', 'archived'],
	'archived' => '0',
	'start' => '0',
	'length' => '25',
	'draw' => '4',
]);

Example response

{
  "data": [
    {"id": "42", "name": "Emergency repair", "priority": "4", "archived": "0"}
  ],
  "draw": 4,
  "recordsTotal": "8",
  "recordsFiltered": "6"
}

Non-table mode returns only {"data":[...]}. Stored meta remains text; named metadata keys are extracted into their requested response keys.

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"}The generated mapped/filter query fails.
Runtime warning or type errorfields, grouping, or advanced-search values use unsupported scalar shapes.

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

Behaviour and edge cases

  • Archived and active rows are both eligible unless the caller supplies an archived filter. Job types have no soft-delete filter.
  • Table mode applies paging and returns database scalar counts. Non-table mode is unlimited unless limit is positive.
  • Relative date boundaries use the tenant timezone; all other filters are tenant-scoped but independent of tenant settings.

See it in Fieldmotion

CRM1

CRM1 uses JobTypes_getDT for the Job Types table and does not directly call this mapped route.

CRM2

Open Settings → Job Types. The shared display widget derives JobTypes_getDataTable from the plural API prefix and sends the visible/configured mapped fields.

Related endpoints