lightning/stateManagerRecord

This state manager gets record data.

Record retrieval requires a record ID, and a list of fields you want for the record.

setConfig()

Provide the entire configuration as an object. This function is equivalent to the factory function when you create the state manager.

setRecordId()

Set the record ID of the record to retrieve.

setFields()

Set the record fields to retrieve. Provide field or an array of fields to return. Specify field names in the format ObjectApiName.FieldName, or use @salesforce/schema items.

If the context user doesn’t have access to a field, an error is returned. Use optionalFields if you’re not sure whether the context user has access to a field and you don’t want the state manager to return an error if they don’t.

setOptionalFields()

Set the record fields to retrieve. Provide field or an array of fields to return. Specify field names in the format ObjectApiName.FieldName, or use @salesforce/schema items.

Optional fields don't cause an error if the context user doesn’t have access to a field.

status

The current status of the state manager. See status for details.

data

When status is "loaded", a Record.

In the Record response, don’t use the recordTypeInfo property. Instead, use the recordTypeId property, which is returned for every record.

error

When status is "error", this property contains details. See error for details.

See Also