force:recordPreview

force:recordPreview has been deprecated. Use force:recordData instead.
Methods

This component supports the following methods.

getNewRecord: Loads a record template and sets it to force:recordPreview’s targetRecord attribute, including predefined values for the entity and record type.

reloadRecord: Performs the same load function as on init using the current configuration values (recordId, layoutType, mode, and others). Doesn’t force a server trip unless required.

saveRecord: Saves the record.

deleteRecord: Deletes the record.

Attributes

Attribute Name Attribute Type Description Required?
fields String[] List of fields to query.

This attribute or layoutType must be specified. If you specify both, the list of fields queried is the union of fields from fields and layoutType.

ignoreExistingAction Boolean Whether to skip the cache and force a server request. Defaults to false.

Setting this attribute to true is useful for handling user-triggered actions such as pull-to-refresh.

layoutType String Name of the layout to query, which determines the fields included. Valid values are the following.
  • FULL
  • COMPACT

This attribute or fields must be specified. If you specify both, the list of fields queried is the union of fields from fields and layoutType.

mode String The mode in which to access the record. Valid values are the following.
  • VIEW
  • EDIT
Defaults to VIEW.
recordId String The 15-character or 18-character ID of the record to load, modify, or delete. Defaults to null, to create a record.
targetError String A reference to a component attribute to which a localized error message is assigned if necessary.
targetRecord Record A reference to a component attribute, to which the loaded record is assigned.

Changes to the record are also assigned to this value, which triggers change handlers, re-renders, and so on.

Events

Event Name Event Type Description
recordUpdated COMPONENT The event fired when the record is loaded, changed, updated, or removed.