Asset maintenance
Set a maintenance next date
/a/AssetMaintenance_setNextDate
Replace the cached next date on one asset maintenance record.
When to use this endpoint
AssetMaintenance_setNextDate is an internal compatibility helper used when the current maintenance job is rescheduled. It is not a complete recurrence-rescheduling API.
Authentication and permissions
The request must establish an authenticated tenant through signed API-key fields or a CRM session. The handler checks tenant context but performs no page, role, or feature-permission check.
The update is scoped to the authenticated tenant table.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer string | Yes | Positive maintenance ID. Existence is not checked. |
val | Datetime string | Yes | New cached date in YYYY-MM-DD HH:MM or YYYY-MM-DD HH:MM:SS shape. Only the character pattern is checked, not calendar validity. |
Example request
$result = FM_api('AssetMaintenance_setNextDate', [
'id' => '61003',
'val' => '2026-10-16 11:30:00',
]);
Example response
{
"id": 1
}
id is the constant integer 1, not the changed record ID.
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. |
{"error":"missing or invalid parameter: val"} | val is absent or null. |
{"error":"Invalid date format: val"} | The value does not match the accepted datetime pattern. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- A missing maintenance ID still returns the success response.
- The normal internal caller is
Job_save, which passes the edited job start datetime when the job is the maintenance record’snextAppID.
Side effects
- Updates
next_dateand invalidates the maintenance cache. No edit datetime or audit entry is written.
See it in Fieldmotion
CRM1
No direct UI call was found. Reschedule the current maintenance job in CRM1 and the job-save path calls this helper internally.
CRM2
No direct production CRM2 caller was found. Current recurrence maintenance uses recurrence/job update APIs.
Related endpoints
AssetMaintenance_getDTdisplays and may repair the cached next date.AssetMaintenance_updateFieldcan also writenextDatebut applies even less format validation.