The Salesforce Developers website will undergo maintenance on May 29, 2024 from 3:00 a.m. UTC to 10:00 a.m. UTC. The maintenance process may affect the availability of our documentation. Please plan accordingly.

generateUrl()

Generates a URL for a specified page reference.

Method InputTypeRequired/OptionalDescription
contextStringRequiredThe ID of the parent router container nearest to the component that's generating a URL. A ContextId is an opaque value that you get from the NavigationContext wire.
pageReferenceStringRequiredThe PageReference value for which to generate a URL.
  • If pageReference is valid, generateUrl() returns a string with the generated URL for the specified route.
  • If pageReference is invalid, it returns null.
  • If context is invalid, generateUrl() fails.

See Also