# data update record

Updates a single record of a Salesforce or Tooling API object.

## Description for data update record

Specify the record you want to update with either its ID or with a list of field-value pairs that identify the record. If your list of fields identifies more than one record, the update fails; the error displays how many records were found.

When using field-value pairs for both identifying the record and specifiyng the new field values, use the format \<fieldName>=\<value>. Enclose all field-value pairs in one set of double quotation marks, delimited by spaces. Enclose values that contain spaces in single quotes.

This command updates a record in Salesforce objects by default. Use the --use-tooling-api flag to update a Tooling API object.

## Aliases for data update record

`force:data:record:update`

## Flags

| Flag Name (Long)          | Flag Name (Short) | Description                                                                                                                                         |
| ------------------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--api-version`           | N/A               | **Type:** Value<br><br>Override the api version used for api requests made by this command                                                          |
| `--flags-dir`             | N/A               | **Type:** Value<br><br>Import flag values from a directory.                                                                                         |
| `--json`                  | N/A               | **Type:** Boolean<br><br>Format output as json.                                                                                                     |
| `--record-id`             | `-i`              | **Type:** Value<br><br>ID of the record you’re updating.                                                                                            |
| `--skip-assignment-rules` | N/A               | **Type:** Boolean<br><br>Don't apply active assignment rules when updating the record; applies to Account, Case, and Lead records.                  |
| `--sobject`               | `-s`              | **Type:** Value<br>**Required**<br><br>API name of the Salesforce or Tooling API object that contains the record you're updating.                   |
| `--target-org`            | `-o`              | **Type:** Value<br>**Required**<br><br>Username or alias of the target org. Not required if the `target-org` configuration variable is already set. |
| `--use-tooling-api`       | `-t`              | **Type:** Boolean<br><br>Use Tooling API so you can update a record in a Tooling API object.                                                        |
| `--values`                | `-v`              | **Type:** Value<br>**Required**<br><br>Fields that you're updating, in the format of <fieldName>=<value> pairs.                                     |
| `--where`                 | `-w`              | **Type:** Value<br><br>List of <fieldName>=<value> pairs that identify the record you want to update.                                               |

## Examples for data update record

Update the Name field of an Account record with the specified (truncated) ID:

```shell
sf data update record --sobject Account --record-id 001D0 --values "Name=NewAcme"
```

Update the Name field of an Account record whose current name is 'Old Acme':

```shell
sf data update record --sobject Account --where "Name='Old Acme'" --values "Name='New Acme'"
```

Update the Name and Website fields of an Account record with the specified (truncated) ID:

```shell
sf data update record --sobject Account --record-id 001D0 --values "Name='Acme III' Website=www.example.com"
```

Update the ExpirationDate field of a record of the Tooling API object TraceFlag using the specified (truncated) ID:

```shell
sf data update record -t --sobject TraceFlag --record-id 7tf170000009cUBAAY --values "ExpirationDate=2017-12-01T00:58:04.000+0000"
```
