Files
Update mapped file data
/a/File_updateData
Update several mapped fields on one or more non-deleted files, recording field history and sending file-update/mention notifications.
When to use this endpoint
Use File_updateData for CRM2 file-table edits, especially notes fields that may contain user mentions.
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 |
|---|---|---|---|
id | Integer-compatible or native array | Yes | One file ID or a native list. Lists update sequentially; a later error returns updatedIds and failedId, while earlier writes remain. JSON-encoded list text is not decoded. 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. |
Mapped fields | Mixed | No | Any mapped keys from 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. Unmapped keys are ignored by the data update but remain available to surrounding notification logic. |
paramTypeEnum | Integer-compatible | No | Removed before update and used only to choose a CRM mention-notice link/message. Supported branches include Customer, Asset, Job, User, recurring Job, Quote, Task, Contract, Stock, and Purchase Order. |
paramPageID | Integer-compatible | No | Parent screen/resource ID embedded in that mention link. |
Example request
$result = FM_api('File_updateData', [
'id' => '4821',
'notes' => 'Please review this file, @Alex',
'paramTypeEnum' => '2',
'paramPageID' => '1042',
]);
Example response
{
"ok": 1,
"oldData": {"notes": "Previous notes"}
}
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: id"} | ID key is absent. |
{"warning":"no updated fields.","oldData":[]} | No mapped update field is supplied. |
{"warning":"No data.","oldData":[]} | The ID does not name a non-deleted row. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Changed fields set
last_editedand receive individualfilesaudit history entries. Soft-deleted rows are excluded. No-op values returnNo Change.. sendNotificationruns after a successful helper response. With a supported type/page pair,sendNoticesalso creates mention notices linked to the relevant CRM1 page.- There is no transaction spanning the update and notifications; multi-ID processing stops on an error and reports updatedIds/failedId; non-error warnings can be hidden by its final ok response.
- 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.
- Omitted/native-null mapped fields are skipped; blank text is stored, blank date/JSON clears to NULL and numeric blanks convert to zero. Unknown fields are ignored by the primary writer. Whole meta replaces the saved object; nested mapped aliases preserve siblings. Datetime text is less strictly checked than date aliases.
- Changed primary values are saved before notification/mention work. No-change/No data warnings also reach the surrounding notification code because only error stops it. paramTypeEnum=0 represents Customers; its omission leaves the local empty-string selector, not an explicit valid resource type.
See it in Fieldmotion
CRM1
No direct production CRM1 editor was found; CRM1 uses File_setNotes and dedicated switches.
CRM2
Edit Notes or another inline file value on modern Customer, Job, Asset, User, and other file tables.
Related endpoints
File_setFieldis the narrower single-field route.- File identifiers and downloads explains file ID, resource ID, type enum, stored URL and the different content response shapes.