record_update()
Update one or more fields on an existing record.
Syntax
record_update(table, id, data, opts?)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
table |
string | yes | Table name or database table id. |
id |
int | yes | The record's primary key. |
data |
array | yes | Field values to change, keyed by field id. Fields you omit are left unchanged. |
opts |
array | no | Options. ["silent" => true] suppresses notifications to the record's followers. |
Returns
true on success. Throws if the record is not found.
Example
record_update("deals", $record["_meta"]["id"], [
"stage" => "won",
"closed_on" => sys_current_date()
]);
Example output
true
Setting file fields
A file field's value is an array of file items. From an automation you can set one without a manual upload — each item is one of:
record_update("deals", $id, [
// 1. copy a file off another record — InfoLobby stores an independent copy
"contract" => record_get("templates", 5)["contract"],
// 2. fetch from a URL
"attachments" => [
["url" => "https://example.com/report.pdf", "name" => "report.pdf"]
],
// 3. build from base64 (raw base64 or a data: URI)
"logo" => [
["data" => $base64String, "name" => "logo.png", "type" => "image/png"]
]
]);
- Copying a file from another record makes a separate copy, so deleting the source record never removes this one's file.
- URL items are fetched server-side (public HTTP/HTTPS only) and capped at 50 MB.
- base64
datamay be raw base64 or adata:<mime>;base64,...URI. - You can mix existing files and new items in the same array (the array replaces the
field's whole file list). If any file can't be fetched, decoded, or copied, the
whole
record_updatefails — the record is never left half-changed.
Notes
- Only the fields you pass are changed; everything else stays as-is.
- The change is recorded in activity history but does not trigger other automations.
["silent" => true]mutes follower notifications only; newly-assigned users are still notified. See Notifications.
See also: record_create(), record_get()