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

ParameterTypeRequiredDescription
fieldStringYesExact map key: id, name, meta, lastEdited, attrs, rentalTypeID, or metaURL.
valMixedYesValue applied to every matched row. Null is rejected as absent; map types control integer conversion and JSON handling.
id / idsInteger string or arrayYesTarget 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

ResponseCondition
{"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 metaURL field is merged and written one row at a time.
  • field=lastEdited does 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