7

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?

  • Could you provide some code to show how you are performing the redirect? – Mark Keats Nov 17 '16 at 10:36
  • 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 May 14 '17 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 Nov 20 '17 at 4:50
3

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

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.