# data get record

Retrieve and display a single record of a Salesforce or Tooling API object.

## Description for data get record

Specify the record you want to retrieve 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 command fails; the error displays how many records were found.

When specifying field-value pairs, 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.

The command displays all the record's fields and their values, one field per terminal line. Fields with no values are displayed as "null".

This command retrieves a record from Salesforce objects by default. Use the --use-tooling-api flag to retrieve from a Tooling API object.

## Aliases for data get record

`force:data:record:get`

## 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 retrieving.                                                                                          |
| `--sobject`         | `-s`              | **Type:** Value<br>**Required**<br><br>API name of the Salesforce or Tooling API object that you're retrieving a record from.                       |
| `--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 retrieve a record from a Tooling API object.                                                    |
| `--where`           | `-w`              | **Type:** Value<br><br>List of <fieldName>=<value> pairs that identify the record you want to display.                                              |

## Examples for data get record

Retrieve and display a record from Account with the specified (truncated) ID:

```shell
sf data get record --sobject Account --record-id 00180XX
```

Retrieve a record from Account whose name equals "Acme":

```shell
sf data get record --sobject Account --where "Name=Acme"
```

Retrieve a record from Account identified with two field values, one that contains a space; the command uses the org with alias "my-scratch":

```shell
sf data get record --sobject Account --where "Name='Universal Containers' Phone='(123) 456-7890'" --target-org myscratch
```

Retrieve a record from the Tooling API object TraceFlag with the specified (truncated) ID:

```shell
sf data get record --use-tooling-api --sobject TraceFlag --record-id 7tf8c
```
