A force:recordData component defines the parameters for accessing, modifying, or creating a record using Lightning Data Service.
<aura:component> <force:recordData aura:id="forceRecordCmp" recordId="{!v.recordId}" layoutType="{!v.layout}" fields="{!v.fieldsToQuery}" mode="VIEW" targetRecord="{!v.record}" targetFields="{!v.fields}" targetError="{!v.error}" /> </aura:component>
This component supports the following methods.
Attribute Name | Attribute Type | Description | Required? |
---|---|---|---|
body | Component[] | The body of the component. In markup, this is everything in the body of the tag. | |
fields | ArrayList | Specifies which of the record's fields to query. | |
layoutType | String | Name of the layout to query, which determines the fields included. Valid values are FULL or COMPACT. The layoutType and/or fields attribute must be specified. | |
mode | String | The mode in which to load the record: VIEW (default) or EDIT. | |
recordId | String | The record Id | |
targetError | String | Will be set to the localized error message if the record can't be provided. | |
targetFields | Object | A simplified view of the fields in targetRecord, to reference record fields in component markup. | |
targetRecord | Object | The provided record. This attribute will contain only the fields relevant to the requested layoutType and/or fields atributes. |
Event Name | Event Type | Description |
---|---|---|
recordUpdated | COMPONENT | Event fired when the record has changed. |