Skip to main content

Parameters

The updateRecords() method object can contain the following properties:

ParameterTypeRequiredDescription
tablestringYesThe name of the table to update.
dataRecord<string, any> | UpdateRecordRow[]YesThe data payload for the update. This can be a single object (for conditional updates) or an array of objects (for batch updates). See Data payload structure.
whereRecord<string, any>YesA filter object with conditional logic used to identify the records that should be updated. This parameter is always required.
optionsUpdateRecordsOptionsNoConfiguration flags that control the behaviour of the update. See Update records options.
withRecord<string, UpdateNestedRecord>NoAn object specifying related tables to update simultaneously. See Nested updates.

Data payload structure

The data parameter supports two structures:

  1. Single Object Payload: Used when performing a single update on a filtered set of records.

    TypeScript
    data: { name: 'New Name', status: 'active' }
  2. Array Payload (UpdateRecordRow[]): Used for batch updates, where each object can optionally contain per-row validation rules.

    Field (in Array Object)TypeRequiredDescription
    [Fields to Update]Record<string, any>YesThe object containing the fields and their new values for the update.
    validationRecord<string, ValidationRule>NoPer-row validation rules to be applied before the update.

Update records options

OptionTypeDefaultDescription
sanitizebooleantrueCleans input values (for example stripping dangerous characters) before saving them to the database.
upsertbooleanfalseIf true, a new record is inserted if no existing record matches the where criteria.
conflictKeysstring[][]An array of fields used to detect conflicts during an upsert operation.
conflictKeysLogic'and' | 'or''and'Specifies how to combine the conflict keys using logical and or or.
transactionalbooleanfalseIf true, the update is treated as a single transaction. All updates must succeed or all fail.
chunkSizenumber1000The batch size for processing large arrays of records.
dryRunbooleanfalseSimulates the update and returns the intended changes without modifying the database.
continueOnErrorbooleanfalseIf true, processing continues even if some records fail to update.
validationRuleRecord<string, ValidationRule>{}A global validation object applied to all records in the update.