Source
force-app/main/default/lwc/navToRelatedList/navToRelatedList.js
Usage
NavigationMixin
Extend your component withNavigationMixin to access navigation capabilities:
PageReference
Set to
standard__recordRelationshipPage for related list pagesThe ID of the parent record
The API name of the parent object (e.g., ‘Account’, ‘Contact’)
The API name of the related list. For standard relationships, use the plural child object name (e.g., ‘Contacts’, ‘Opportunities’). For custom relationships, use the relationship name from the object definition
Set to
view to display the related listFinding Relationship API Names
Standard Relationships
Common standard relationship names:Contacts- Contacts related to an AccountOpportunities- Opportunities related to an AccountCases- Cases related to an Account or ContactActivityHistories- Completed activitiesOpenActivities- Upcoming activities
Custom Relationships
For custom relationships, find the relationship name in Setup:- Navigate to Object Manager
- Select the parent object
- Click on Fields & Relationships
- Find the relationship field
- Use the “Child Relationship Name” value
Examples
Account Contacts
Account Opportunities
Key Features
- Navigate to related lists on record pages
- Supports standard and custom relationships
- Type-safe navigation with PageReference
- Works with all standard and custom objects
