Asset maintenance
Export asset maintenance CSV
/a/AssetMaintenance_export
Download the legacy filtered Asset Maintenance list as CSV.
When to use this endpoint
Use AssetMaintenance_export for CRM1’s Export button after applying its date, active-state, and text filters. The route streams a file rather than returning JSON.
Authentication and permissions
The handler requires an authenticated tenant user. CRM1 submits its session CSRF token with the form post.
There is no explicit page, role, Asset-feature, or export-permission check.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
daysFrom | Integer string | No | Lower day offset from current server datetime; defaults to 0. CRM1 normally sends -7. Date strings are not accepted as dates and merely integer-convert from their leading year. |
daysTo | Integer string | No | Upper day offset from current server datetime; defaults to 0. CRM1 normally sends 7. |
search | String | No | Case-insensitive/collation-dependent substring applied across asset name/code, maintenance and recurrence IDs, owner, description, next date, and recurrence dates. If the key is present but blank, a match-all search group is added. |
active | Integer string | No | Exact recurrence active-state filter. Presence matters: blank becomes 0; omission includes both active and inactive rows. |
Example request
// Use an authenticated POST/download client, not a JSON decoder.
[
'daysFrom' => '-7',
'daysTo' => '7',
'active' => '1',
'search' => 'filter',
]
Example response
"Asset Maintenance ID",Asset,Owner,Description,"Next Job",Started,Expires,Recurs,Status
61003,"Compressor A (CMP-1)","Acme Services","Filter service","15/10/2026 - Pat Lee",2026-09-24,,"every 3 months",Active
The response has Content-Type: text/csv, attachment filename asset_maintenance.csv, and no JSON envelope.
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. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- The date predicate includes schedules created before the lower boundary whose next date is after it, plus schedules created between the lower and upper boundaries. It is not simply a next-date range.
- Soft-deleted assets and maintenance rows with no matching active asset row are excluded. There is no pagination, row limit, or explicit ordering.
- Frequency labels are produced only for unit values
3through6. The user shown after Next Job comes from the current linked job; a missing assignment becomesuser not set. - One extra user-name query is performed per exported row.
Side effects
- Creates or replaces
/tmp/<tenant>/tmp/asset_maintenance.csv, streams it, and leaves the file in place. Business records are unchanged.
See it in Fieldmotion
CRM1
Open Assets → Maintenance, set the date/status/search filters, click Export, and inspect the form POST to AssetMaintenance_export.
CRM2
No production CRM2 caller was found; CRM2 exports its modern recurrence table through JobRecurrences_getDataTable and the mapped export widget.
Related endpoints
AssetMaintenance_getDTuses the same legacy filters for the on-screen page.AssetMaintenances_getDataTableexposes mapped maintenance fields rather than CSV.