Asset maintenance
Query mapped asset maintenance rows
/a/AssetMaintenances_getDataTable
Query mapped maintenance rows and enrich each result with its linked recurrence record.
When to use this endpoint
Use AssetMaintenances_getDataTable only when consuming the older mapped maintenance model. Current CRM2 Maintenance screens query job recurrences directly instead.
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 |
|---|---|---|---|
fields | Array | Yes | Native array containing any mapped maintenance fields: id, name, nextDate, history, assetID, cDate, recurrence, meta, recurrenceID, nextAppID, lastDate, and defaultUser. Unknown names are ignored; id is always added. |
isTable | Integer string | No | Defaults to table mode. Exact integer 0 returns only data and enables optional positive limit. |
draw / start / length / limit | Integer strings | No | Shared table counter, offset, page size, and non-table limit. Table defaults are 0, 0, and 10; zero/negative page sizes are not rejected before SQL. |
orderBy / orderDesc or order[0] | Shared ordering values | No | Sort by a mapped field. Named lookup is exact then case-insensitive; DataTables ordering subtracts one from the UI column index. |
searchValue / searchField | String / string or array | No | Case-insensitive substring search over selected mapped fields. Omitted searchField searches all mapped fields. |
Mapped field filters | Scalar or array | No | Any map key can filter rows. Text values use substring matching, numeric values use equality, and arrays use IN. |
referenceDate / dateFrom / dateTo / offsets | Shared relative-date values | No | Mapped datetime references include nextDate, cDate, and lastDate. Day bounds are inclusive and derived from today in the tenant timezone. |
advanceSearch / groupBy | Arrays | No | Shared CRM2 advanced conditions and mapped grouping. Use only trusted, mapped field forms. |
Example request
$table = FM_api('AssetMaintenances_getDataTable', [
'fields' => ['id', 'name', 'nextDate', 'assetID', 'recurrenceID'],
'assetID' => '418',
'draw' => '1',
'start' => '0',
'length' => '25',
'orderBy' => 'nextDate',
'orderDesc' => 'asc',
]);
Example response
{
"data": [
{
"id": "61003",
"name": "Filter service",
"nextDate": "2026-10-15 09:00:00",
"assetID": "418",
"recurrenceID": "879027",
"every": "5",
"onArr": "3",
"ids": "2039001,2039002",
"eDate": null,
"active": "1",
"rID": "879027",
"rName": "Asset Maintenance: Filter service",
"customerID": "418",
"notes": null,
"userID": "0",
"formID": "0",
"meta": "{\"copy_job_value\":1,\"due_date_offset\":0}",
"rCreatedDate": "2026-09-24",
"departmentID": "0"
}
],
"draw": 1,
"recordsTotal": "12",
"recordsFiltered": "1"
}
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"} | The mapped maintenance query fails. |
Runtime warnings with null enrichment fields | A maintenance row references a missing recurrence row; the enrichment path does not guard that lookup. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- All recurrence enrichment fields are appended whether requested or not. One additional full-row recurrence query is executed per returned maintenance row.
- Table mode returns counts across maintenance rows; there is no deleted/active/asset-existence filter unless the caller supplies mapped filters.
- Non-table mode is unlimited unless a positive
limitis provided.
See it in Fieldmotion
CRM1
No production CRM1 caller was found; CRM1 uses the positional AssetMaintenance_getDT endpoint.
CRM2
No current production CRM2 caller was found. The Maintenance page uses JobRecurrences_getDataTable, not this compatibility endpoint.
Related endpoints
AssetMaintenance_getDTsupplies CRM1’s purpose-built table.AssetMaintenance_updateFieldchanges fields from the same maintenance map.