---
schema_version: "1"
id: 6115fc2bd297fa6096c20755fae08f78c9078e9efb37f88e6b430f8af3ce7779
title: Update a Record
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/graphql-api/graphql/guides/mutations/mutations-update.md
canonical_url: https://developer.salesforce.com/docs/platform/graphql/guide/mutations-update.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 3d29825823d6c971f47ef60d438d40d91393830e0367d966545df8c1c6b76998
products:
  - GraphQL API
---
# 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](https://developer.salesforce.com/docs/platform/graphql/guide/mutations-schema.md) enables you to update all object types your Salesforce user has access to. Only [objects supported by UI API](https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_get_started_supported_objects.htm) are available for mutations.

## Example Update Request

To update a record, use `RecordUpdate` with the `Id` and field values for the record you want to update.

**note:** 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.

```
mutation ContactUpdateExample{
  uiapi {
    ContactUpdate(input: {
      Contact: {
        FirstName: "Sam"
        LastName: "Smith"
      }
      Id: "003RM000008AAAAAA4"
    }) {
      Record {
        Id
        FirstName {
            value
        }
        LastName {
            value
        }
      }
    }
  }
}
```

## Example Response on Successful Update

The response body returns the fields you request under `Record`.

```
{
  "data": {
    "uiapi": {
      "ContactUpdate": {
        "Record": {
          "Id": "003RM000008AAAAAA4",
          "FirstName": {
            "value": "Sam"
          },
          "LastName": {
            "value": "Smith"
          }
        }
      }
    }
  },
  "errors": []
}
```

## Record Update Guidelines

Consider these guidelines for updating a record.

- For compound fields, use the constituent fields. For example use `FirstName` and `LastName` instead of `Name`.
- For numerical field values, such as integers or currency, use the raw values. For example, use `80000` instead of `80,000` and don’t include currency symbols.
- Sending an update request with field values that don’t match the supported format returns a [`ValidationError`](https://developer.salesforce.com/docs/platform/graphql/query/query-status.md). Use the appropriate format for the field, such as [`YYYY-MM-DD` for date fields](https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_dateformats.htm).
- Sending an update request with an incorrect `Id` value returns a `DataFetchingException` error.

## See Also

[Send Mutation Requests](https://developer.salesforce.com/docs/platform/graphql/guide/mutations-use.md)
