Asset maintenance
Delete an asset maintenance schedule
/a/AssetMaintenance_delete
Permanently remove an asset maintenance record and recurrence after deleting its incomplete jobs.
When to use this endpoint
Use AssetMaintenance_delete for the final removal of a maintenance record. CRM1 presents this action after a schedule is inactive, although the endpoint itself does not enforce that sequence.
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 |
|---|---|---|---|
id | Integer string | Yes | Positive maintenance ID. Existence and active state are not validated before related deletes begin. |
Example request
$result = FM_api('AssetMaintenance_delete', [
'id' => '61003',
]);
Example response
{
"mr": {
"id": "61003",
"name": "Filter service",
"asset_id": "418",
"recurrence_id": "879027",
"next_app_id": "2039001"
},
"rr": {
"id": "879027",
"ids": "2039001,2039002",
"active": "0"
},
"aidsr": [
{"id": "2039002"}
]
}
mr and rr are the complete maintenance and recurrence database rows captured before deletion; the example shows representative fields. aidsr lists incomplete, non-deleted jobs selected for deletion.
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: id"} | id is absent or not positive. |
Nominal response with false/empty row values and runtime warnings | The maintenance ID does not exist; the handler does not stop after the failed 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
- Completed jobs are retained. Only incomplete, non-deleted job IDs present in the recurrence’s legacy comma-separated list are passed to normal job deletion.
- The stored ID list is inserted into the lookup without normalization; malformed legacy recurrence data can cause a query failure.
- Active schedules can be deleted directly. The handler has no page, role, or Asset-feature permission check.
Side effects
- Each selected job follows normal job soft-deletion, including its deletion-poll/audit and relationship cleanup.
- Hard-deletes the recurrence, maintenance record, and tenant-specific global scheduler row. It logs deletion of the recurrence but not the maintenance row itself.
See it in Fieldmotion
CRM1
Open Assets → Maintenance. An inactive row shows the delete marker; confirm it and inspect AssetMaintenance_delete. Active rows show Disable instead.
CRM2
No production CRM2 caller was found; the modern screen manages asset-scoped job recurrences through recurrence endpoints.
Related endpoints
AssetMaintenance_disableretains the recurrence and maintenance record while stopping it.AssetMaintenance_getDTexposes active state and linked job IDs used by CRM1.