Navigate to Pages, Records, and Lists
To navigate in Lightning Experience, Experience Builder sites, and the Salesforce mobile app, use the navigation service, lightning/navigation
.
The lightning/navigation
service is supported only in Lightning Experience, Experience Builder sites, and the Salesforce mobile app. It isn’t supported in other containers, such as Lightning Components for Visualforce, or Lightning Out. This is true even if you access these containers inside Lightning Experience or the Salesforce mobile app.
To generate a URL for a component so you can navigate directly to it, use the lightning__UrlAddressable
target on your component. This target is supported only in Lightning Experience and the Salesforce mobile app. It's also supported in custom apps, such as in a Lightning console app. This target isn't supported in Experience Builder sites, since it interferes with custom domain and CDN support.
See Also
- PageReference Types
- Lightning Web Component Library: lightning-navigation
- Test the Navigation Service