I have a VF page where i am creating a lightning component(createComponent and App using ltng:outApp). In this lightning component i am trying to use lightning:navigation. Also tried using e.force:navigateToComponent. Both of them are not working. I am getting

Error: Cannot read property 'setParams' of undefined.

I tried to call the component even without any parameters. Its not working.


The time you use lightning out on your VF page, you are using it through a Lightning App, and that any component you create is created within that app. So in turn your Lightning Component is running inside an app, within the VF page.

A good way to verify if a component is supported or not is to look at the Experience section of any component's documentation on the documentation site.

If you take a look at lightning:navigation documentation, this component is not supported in Lightning Application but only in Lightning Experience and Salesforce Mobile App.

enter image description here

  • Thanks Jayant. Is there any alternative to navigate? – Arteezy Oct 24 '18 at 21:26
  • You may just want to utilize a href in this scenario. – Jayant Das Oct 24 '18 at 21:28
  • a href to a vf page which again creates a new lightning component? Cause navigation is from component to component. – Arteezy Oct 24 '18 at 21:30
  • Not completely sure how is your current implementation, but you may like to open that as a separate question seeking ideas on the approach. – Jayant Das Oct 24 '18 at 21:31
  • No i think this will work. sforce.one.navigatetoURL. Thanks Jayant – Arteezy Oct 24 '18 at 21:32

Looks like they are only supported in lightning experience and Salesforce Mobile App lightning:navigation

With the lightning:isUrlAddressable interface, you now control which Lightning components can be opened programmatically. You can also now easily capture URL parameters using the v.pageReference attribute and use the parameter values in your component. With the lightning:navigation component, define a pageReference object for navigating to a custom component that implements lightning:isUrlAddressable and set any attributes the component allows.

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. Summer 18 release notes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.