# 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](/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.

```sfdocs-code {"lang":"graphql", "title": "Update Contact with Field Values", "src": "" }
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`.

```sfdocs-code {"lang":"json", "title": "Response for Update Contact with Field Values", "src": "" }
{
  "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`](/docs/platform/graphql/guide/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](/docs/platform/graphql/guide/mutations-use.md)
