New Lightning Navigation APIs for Lightning Components
Where: This change applies to orgs with Lightning components in Lightning Experience and all versions of the mobile app. These resources aren’t supported in other containers, such as Lightning Components for Visualforce, Lightning Out, or Communities. This is true even if you access these containers inside Lightning Experience or the Salesforce mobile app.
Why: In standard navigation Lightning apps, you can use the lightning:navigation component to navigate to a custom component that implements lightning:isUrlAddressable. Using lightning:navigation with pageReference provides the following benefits over the now deprecated force:navigateToComponent for standard navigation Lightning apps.
- Gives you control over whether a component can be opened programmatically, and which attributes can be dynamically set when the component is opened.
- Control and manage which URL parameters are used in your component.
- Future-proofs your apps from changes in URL format.
- Generates a user-friendly URL for these components.
A page reference is associated with a particular type, which provides a set of attributes that are applicable for all pages of that type. The following types are supported.
- Knowledge Article Page
- Lightning Component (must implement lightning:isUrlAddressable)
- Named Page
- Navigation Item Page
- Object Page
- Record Page
- Record Relationship Page
In Lightning console apps, you can open custom components that implement lightning:isUrlAddressable via openSubtab(), even from utilities.