Files
Update one mapped file field
/a/File_updateField
Set one mapped field on one or more non-deleted files through the shared update-field engine.
When to use this endpoint
File_updateField is a legacy alias-shaped wrapper with the same request and behavior as File_setField. Prefer the route already used by the calling screen.
Authentication and permissions
Normal API transport requires signed API-key fields or a logged-in CRM session and a tenant context. Session CSRF applies except for the dispatcher’s upload/download exceptions.
These handlers do not add general Files Add/Edit/Delete or file-owner role checks. UI visibility is not that protection. Configured team-scope entry checks are separate and may validate the linked record and its Edit permission before a handler runs; see the route-specific note below. This does not introduce CRM2 role requirements for ordinary CRM1 requests.
When department/team or Assigned Jobs Only scope is configured for the actor, the dispatcher adds record-scope checks. This is selected by account features/actor flags, separately from the CRM2-only Files View check; the existing TeamAccess entry guard has no CRM-version condition. Explicit id/ids values are checked against visible file records. Other filename-only selections or mapped-filter-only bulk mutations can be rejected for lacking an explicit scoped selection.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
field | String | Yes | One mapped file field: id, filename, typeId, description, cDate, notes, ownerID, meta, name, typeEnum, lastEdited, url, customerReadable, fileLast_Edited, deleted, ddate, storageType, storageInstance, data, filesize, metaUserID, metaDateExpiry, metaTags, metaIncludeInEmail, metaEditNotesInPortal, metaShareWithSites, metaShowInPortal, metaOutsourcing, and metaLinkForm. |
val | Mixed | Yes | Replacement value. |
id / ids | Integer-compatible or native array | Yes | Target ID(s); id wins when both exist. Use the tenant file-record ID returned by upload/list/detail calls. This is separate from type_id/typeId (the linked resource ID), and from the random token in a storage URL. |
Example request
$result = FM_api('File_updateField', ['ids' => ['4821', '4822'], 'field' => 'notes', 'val' => 'Reviewed']);
Example response
{
"ok": 1,
"oldData": [
{"id": "4821", "notes": ""},
{"id": "4822", "notes": "Pending"}
]
}
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"} | Value is absent. |
{"error":"missing or invalid field"} | Field is unmapped. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Behavior, timestamping, JSON merging, audit logging, soft-delete filtering, and no-change response are identical to
File_setField. - No pagination applies to this write. Use a fresh metadata/list read before dependent work; an error after storage, audit or notification work does not imply that earlier steps were rolled back.
- val must be present and non-null. Blank text persists, numeric blanks become zero and blank date/JSON values clear. Native ID lists are integer-converted; encoded list strings are not decoded. A missing selection may produce a no-change acknowledgement instead of a not-found error.
- oldData uses storage-column names, with the old complete metadata column for nested aliases. JSON updates run per matching row; a later failure can leave prior rows changed. No mapped layout readonly flag creates a server-side allowlist of editable fields here.
See it in Fieldmotion
CRM1
No direct production CRM1 caller was found.
CRM2
The generic widget framework can derive this update route, although current file tables commonly call File_setField or File_updateData.
Related endpoints
File_setFieldis the equivalent endpoint.- File identifiers and downloads explains file ID, resource ID, type enum, stored URL and the different content response shapes.