Record, Object, and List View Navigation
By the end of this lesson, you'll be able to:
- Navigate to a specific record's view, edit, or clone page
- Navigate to an object's home or new-record page
- Navigate to a specific list view
Prerequisites: "NavigationMixin and Page References"
Navigating to a Record
this[NavigationMixin.Navigate]({
type: 'standard__recordPage',
attributes: {
recordId: this.accountId,
objectApiName: 'Account',
actionName: 'view', // or 'edit', or 'clone'
},
});
standard__recordPage navigates to a specific record. actionName determines whether it opens in view, edit, or clone mode.
Navigating to an Object Home or New Record Form
this[NavigationMixin.Navigate]({
type: 'standard__objectPage',
attributes: {
objectApiName: 'Contact',
actionName: 'home', // or 'new'
},
});
standard__objectPage navigates to a whole object's page rather than one specific record — actionName: 'home' for the object's default list view landing page, or 'new' to open the new-record form directly.
Navigating to a List View
this[NavigationMixin.Navigate]({
type: 'standard__objectPage',
attributes: {
objectApiName: 'Opportunity',
actionName: 'list',
},
state: {
filterName: 'Recently Viewed',
},
});
Still standard__objectPage, but with actionName: 'list' and a state.filterName naming the specific list view to open.
Why This Matters in Real Projects
Custom components very often need to send the user somewhere else in the org after an action completes — opening the record that was just created, or taking them back to a relevant list view. Getting the right type/actionName combination is a common, very practical need.
Exercise
Write a PageReference that navigates to the edit page for a Contact record, given a recordId variable.
Show hint
Use standard__recordPage with actionName "edit".
Exercise
Challenge: write a PageReference that opens the new-record form for the Case object.
Show hint
Use standard__objectPage with actionName "new".
Record, Object, and List View Navigation Quiz
My Notes
Log in to keep private notes on this lesson.
Questions about this lesson
No questions yet — be the first to ask.
Log in to ask a question about this lesson.
Summary
The type field on a PageReference selects a category of destination — records, whole objects, or specific list views each have their own attribute shape.