Newer Version Available
Basic Navigation
The pageReference JavaScript object represents
a URL for a page. You can use a pageReference instead of
parsing or creating a URL directly. This approach helps you avoid broken navigation if
Salesforce changes URL formats in the future.
Use the following resources to simplify navigation across your apps. URLs for components using these resources are case-sensitive. For examples, see the Component Library.
- lightning:navigation
-
To navigate to a page or component, use the navigate() method in lightning:navigation. This approach is a substitute for a navigateTo* event, and both are supported.
To generate a URL in your component, use the generateUrl() method in lightning:navigation to resolve the URL. - lightning:isUrlAddressable
- To enable a component to navigate directly via a URL, add the lightning:isUrlAddressable interface to your component.
pageReference provides a well-defined structure that describes the page type and its corresponding attributes. pageReference supports the following properties.
| Property | Type | Description | Required? |
|---|---|---|---|
| type | String | The API name of the pageReference type, for example, standard__objectPage. | Y |
| attributes | Object | Values for each attribute specified by the page definition, for example, objectAPIName or actionName. | Y |
| state | Object | Parameters that are tied to the query string of the URL in Lightning Experience, such as filterName. The routing framework doesn’t depend on state to render a page. Some page reference types support a standard set of state properties. You can also pass non-standard properties into state as long as they are namespaced. |