Overview
Record navigation enables you to navigate to view, edit, or create Salesforce records. This page covers the most common record navigation patterns found in the LWC Recipes repository.Navigate to Record Page
Navigate to a record’s view or edit page using thestandard__recordPage type.
View a Record
Edit a Record
The
actionName attribute supports three values:view- View the recordedit- Edit the recordclone- Clone the record
Navigate to New Record Page
Create new records using thestandard__objectPage type with actionName: 'new'.
Basic New Record
New Record with Default Values
Pre-populate fields on a new record form usingencodeDefaultFieldValues from lightning/pageReferenceUtils.
PageReference Attributes
Use
standard__recordPage for existing records or standard__objectPage for new recordsThe 15 or 18 character record ID (required for
standard__recordPage)The API name of the object (e.g., ‘Contact’, ‘Account’, ‘CustomObject__c’)
The action to perform: ‘view’, ‘edit’, ‘clone’, or ‘new’
Encoded default field values for new records (use
encodeDefaultFieldValues())Common Use Cases
View Record Details
Navigate users from a list or search result to the full record page
Quick Edit
Open the edit page directly from a custom component
Create Related Records
Launch new record forms with pre-populated relationship fields
Clone with Modifications
Clone a record and pre-populate fields with new values
Related Examples
- Navigate to Related List - View related records
- Navigate to List View - Browse filtered record lists
