data get record

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

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.

force:data:record:get

Flag Name (Long)Flag Name (Short)Description
‑‑api‑versionN/AType: Value

Override the api version used for api requests made by this command
‑‑flags‑dirN/AType: Value

Import flag values from a directory.
‑‑jsonN/AType: Boolean

Format output as json.
‑‑record‑id‑iType: Value

ID of the record you’re retrieving.
‑‑sobject‑sType: Value
Required

API name of the Salesforce or Tooling API object that you’re retrieving a record from.
‑‑target‑org‑oType: Value
Required

Username or alias of the target org. Not required if the target-org configuration variable is already set.
‑‑use‑tooling‑api‑tType: Boolean

Use Tooling API so you can retrieve a record from a Tooling API object.
‑‑where‑wType: Value

List of <fieldName>=<value> pairs that identify the record you want to display.

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

Retrieve a record from Account whose name equals “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”:

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