9

I have this scenario where I have overridden Account New button with a Visualforce page which redirects users to a Lightning App when the user is in Lightning Experience or else redirects to another Visualforce page when the user is in Classic. This works fine!

Now when I open the same in Salesforce1, I want the control to go to the Lightning App which is not happening. Getting the following error:

You can't view this page, either because you don't have permission or because the page isn't supported on mobile devices.

Is there any way to navigate to custom Lightning App in Salesforce1 or at least navigate to Lightning Components?

3
  • Could you provide some code to show how you are performing the redirect?
    – Mark Keats
    Commented Nov 17, 2016 at 10:36
  • 1
    Are you using code to determine that the user is in Salesforce1 rather than Lightning or Classic? There's a Trailhead that shows how to find theme4t trailhead.salesforce.com/modules/lex_dev_visualforce/units/…
    – snugsfbay
    Commented May 14, 2017 at 14:22
  • @Santanu: Could you share some code on how you are performing redirect between VF and Lightning on click of new button based on UIThemeDisplayed?
    – user28452
    Commented Nov 20, 2017 at 4:50

2 Answers 2

4

This have been a puzzle for a long time for me.The fact that you cannot from a visualforce page go to a component, the only way i got it to work is by a little hack :

 window.parent.location = '/one/one.app#ew0KICAgICJjb21wb25lbnREZWYiIDogImM6TEMyOF9HZXN0aW9uQ29tcHRlIiwNCiAgICAiYXR0cmlidXRlcyIgOiB7fQ0KICB9';

from your visualforce page redirect to the parent location where the base64 encoding part represent the json component in base64 :

{"componentDef" : "c:LC28_GestionCompte","attributes" : {}}

from the above code, I am redirecting to the LC28_GestionCompte component. For sure this is not the recommended way, but it is the best option i found so far. And even salesforce said that there is no way for now. I serach for every possible post to be able to do it the nice way, but found none. So think this can help someone.

0

In your Account New button Visualforce page, you may want to find out if the UITheme is classic, lightning or salesforce1. You can look at documentation for UserInfo for the details.

see related post , How to detect if a user is in Salesforce1 vs Lightning Desktop

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .