Assets
Update a mapped asset field
/a/Asset_updateField
Set one named Asset map field across one or more non-deleted asset rows.
When to use this endpoint
Use Asset_updateField only for trusted low-level bulk changes to a simple mapped value.
Asset_setField is an exact route alias. Prefer Asset_updateData for normal single-asset layout saves.
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 |
|---|---|---|---|
field | String | Yes | Exact Asset map key. The full map includes core, metadata, relationship, hidden, and nominally read-only fields; those layout flags are not write authorization. |
val | Mixed | Yes | Value applied to every matched row. Null is rejected as absent. Map types control quoting/conversion; blank is accepted for date fields. |
id / ids | Integer string or array | Yes | Target ID or IDs, all integer-converted. id takes precedence over ids. |
Example request
$result = FM_api('Asset_updateField', [
'id' => '4821',
'field' => 'warranty',
'val' => '2027-09-24',
]);
Example response
{
"ok": 1,
"oldData": [
{"id": "4821", "warranty": "2026-09-24"}
]
}
No matching change returns {"ok":"1","warning":"no change required"}. Otherwise oldData contains only matched non-deleted rows and the underlying storage column.
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: field"} | field is absent. |
{"error":"missing or invalid parameter: val"} | val is absent or null. |
{"error":"missing or invalid field"} | The map has no exact matching key. |
{"error":"missing or invalid parameter: id/ids"} | Neither target key is present. |
{"error":"invalid date parameter: FIELD"} | A nonblank mapped date is not a valid YYYY-MM-DD. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Soft-deleted assets are excluded and missing IDs are silently ignored. Archived assets are included.
- Normal-column changes are combined in one update; metadata path changes are applied per asset after parsing the existing JSON.
- The endpoint does not consult
asset-unique-name,asset-unique-code, orasset-unique-book_id. - Changed rows get a refreshed
last_edited. There is no pagination or partial-result detail when some IDs are missing.
Side effects
- Invalidates the asset cache and writes one generic audit entry for the changed IDs. No movement, address snapshot, notification-service event, or relationship-specific cache refresh occurs.
See it in Fieldmotion
CRM1
No direct production CRM1 caller was found.
CRM2
No direct production CRM2 caller was found; CRM2 layout updates use Asset_updateData.
Related endpoints
Asset_setFieldis the exact alias.Asset_updateDatais the normal mapped update workflow.