4

I have an issue that I can't seem to see how you navigate from a Lightning Record Page to a Lightning app without a new pop-up opening.

I have a Lightning Component with just a ui:button that executes the following:

var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
    "url": "/c/MyApp.app?id=xxx"
});
urlEvent.fire();

This component sits within the Lightning record page for an object. The problem is that this opens the App in a new window, not within the Salesforce Lightning experience. I want the click of this button within the record page to navigate to the app - and keep this within Lightning experience so the user can navigate back and still have the sidebar navigation available.

If I attempt to block pop-ups I get the following message:

This page isn't available in Salesforce Lightning Experience or Salesforce1.

The app is marked with the implements="force:appHostable" interface

I can't find anything in the documentation that demonstrates how to navigate from a record page to a custom app.

Any help would be appreciated!

0

The one.app is the lightning app that has the sidebars and all the standard salesforce features.

When you create a custom app, you will notice your app has name like myApp.app. This app doesn't get any of the functionalities of the one.app. If you need a sidebar in this app, you would have to implement it yourself.

If you want to have the sidebar, may be you should navigate to a lightning component tab instead of a lightning app?

Of course this only works if the contents of your app can also be contained within a lightning component and added to a lightning component tab.

---EDIT--- Following this example, Here's how you would do it:

var urlEvent = $A.get("e.force:navigateToURL");
     urlEvent.setParams({
      "url": "https://lightningtest-dev-ed.lightning.force.com/one/one.app?source=aloha#eyJjb21wb25lbnREZWYiOiJvbmyI6ImxpZ2h0bmluZ2twcjpuZXN0ZWRDb21wb25lbnRzIn19LCJ0IjoxNDY3MzkwNDY0NzQwfQ%3D%3D"
    });
    urlEvent.fire();
  • How do you 'navigate' to a Lightning component tab. They don't expose any URL that you can use in the force:navigateToUrl event, and the force:navigateToComponent event is not officially supported in the API documentation so cannot be used. – Mark Keats Jul 1 '16 at 7:03
  • Edited answer to include sample. The url in this example is grabbed from the address bar when you are viewing the lightning component tab. So yea, you would have to hard-code the url to the tab's url – prashanthkr Jul 1 '16 at 16:33
  • 1
    That isn't an acceptable solution. We need to be able to pass parameters to the component, so hard-coding a copied URL won't work. – Mark Keats Jul 4 '16 at 8:20
  • Since there isn't a concept similar to Pagereference for lightning components, this is the only way I see. You can pass parameters to the component even with this hard-coding. Anyways, I will continue to monitor this to see if anyone comes up with a better way. – prashanthkr Jul 6 '16 at 20:07

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.