Asset types
Update one mapped asset-type field
/a/AssetType_updateField
Set one named Asset Type map field across one or more rows.
When to use this endpoint
Use AssetType_updateField only for trusted low-level bulk changes. Normal CRM2 form saves should use AssetType_updateData.
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 map key: id, name, meta, lastEdited, attrs, rentalTypeID, or metaURL. |
val | Mixed | Yes | Value applied to every matched row. Null is rejected as absent; map types control integer conversion and JSON handling. |
id / ids | Integer string or array | Yes | Target ID(s), integer-converted. id takes precedence over ids. Missing IDs are silently ignored. |
Example request
$result = FM_api('AssetType_updateField', [
'ids' => ['47', '58'],
'field' => 'attrs',
'val' => '2',
]);
Example response
{
"ok": 1,
"oldData": [
{"id": "47", "attrs": "0"},
{"id": "58", "attrs": "0"}
]
}
If no matched row needs a change, the response is {"ok":"1","warning":"no change required"} and omits oldData.
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 exact key is not in the field map. |
{"error":"missing or invalid parameter: id/ids"} | Neither target key is supplied. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Normal columns are updated in one statement for changed IDs. The nested
metaURLfield is merged and written one row at a time. field=lastEditeddoes not preserve the supplied timestamp: the helper appends current server time to a changed update.- There is no pagination or partial-result list for missing IDs.
Side effects
- Updates matched rows, refreshes
last_edited, invalidates the asset-type cache, and writes one generic audit entry naming all changed IDs.
See it in Fieldmotion
CRM1
No direct production CRM1 caller was found.
CRM2
No direct production CRM2 caller was found; configurable forms use AssetType_updateData.
Related endpoints
AssetType_setNameis the safe focused rename with duplicate checking.AssetType_setAttrBitpreserves other bits for CRM1’s Vehicle toggle.