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/schemaitems.If the context user doesn’t have access to a field, an error is returned. Use
optionalFieldsif 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/schemaitems.Optional fields don't cause an error if the context user doesn’t have access to a field.
statusThe current status of the state manager. See
statusfor details.dataWhen
statusis "loaded", a Record.In the Record response, don’t use the
recordTypeInfoproperty. Instead, use therecordTypeIdproperty, which is returned for every record.errorWhen
statusis "error", this property contains details. Seeerrorfor details.
See Also
- Nested State Manager Example
- getRecord wire adapter
- User Interface API Developer Guide: Get a Record