Update a Record
| AVAILABLE API VERSION |
|---|
| Beta v59.0–65.0 |
| Generally Available v66.0 and later |
Use mutations to update a record. Within mutations, the RecordUpdate field enables you to update all object types your Salesforce user has access to. Only objects supported by UI API are available for mutations.
To update a record, use RecordUpdate with the Id and field values for the record you want to update.
The RecordUpdatePayload type includes the Record field in API v66.0 and later. In API v59–65, the RecordUpdatePayload type includes a success field returning true or false to denote if the update is successful.
A response is returned when record creation is successful. To define the fields you want the response body to return, use the Record field. You can return the Id and selected fields from your record update.
The response body returns the fields you request under Record.
Consider these guidelines for updating a record.
- For compound fields, use the constituent fields. For example use
FirstNameandLastNameinstead ofName. - For numerical field values, such as integers or currency, use the raw values. For example, use
80000instead of80,000and don’t include currency symbols. - Sending an update request with field values that don’t match the supported format returns a
ValidationError. Use the appropriate format for the field, such asYYYY-MM-DDfor date fields. - Sending an update request with an incorrect
Idvalue returns aDataFetchingExceptionerror.