8

I have a VisualForce page that has navigation which will return users to various views in the Salesforce native interface such as the Home tab, or to specific SObject records.

I have found that if I use window.open('/', '_self') then the user is always taken back to the desktop version of Salesforce even if they are using the Salesforce1 app.

To stop this happening, I am refactoring those bits of code to something like the following:

if(typeof sforce !== "undefined" && sforce !== null) {
    // Salesforce1 navigation
    sforce.one.navigateToSObject(accountId);
} else {
    // Desktop navigation
    window.open('/'+accountId, '_self');
}

The above code using the navigateToSObject() method works fine, but if I try to use to navigateToSObject() method to return the user to the home page, then I get a:

The page you are trying to access is not supported on mobile devices

error.

I have tried all of the following and got the same error:

sforce.one.navigateToURL('/');
sforce.one.navigateToURL('/one/one.app');
sforce.one.navigateToURL('https://emea.salesforce.com/one/one.app');
sforce.one.navigateToURL('/001/e'); // I know this is not the home page

I'm not aware that I can make the home page accessible to mobile devices in the same way that I could make a visualforce page accessible. I would have thought that this is automatic.

I'd like to ask how other people would implement this and if there is anything that people can see that I am doing wrong here.

Thanks

  • When you say "home page" do you mean the one.app home screen? or the /home/home.jsp page you get outside of Salesforce1? – Kris Gray Jul 15 '14 at 17:40
  • I mean the one.app home screen Kris. You can see in the navigateToUrl() examples that I've tried above that I've tried a few different ways to get there. – Joe Jul 15 '14 at 17:50
  • Try sforce.one.editRecord(​recordId) – Thukkaram Sep 18 '15 at 4:12
5

So the way this works is a bit different based on your org, but this should work for you.

sforce.one.navigateToURL("/home/home.jsp");

If that doesn't work for you, when you log in to salesforce without S1, copy the url (relative url should be fine) and use that.

We (currently) get that url and map it to the default component you see. This also means you'll get the back button. Based on what I'm seeing in the code, we don't really provide you a way to go to you back to start (/one/one.app).

  • Joe if you message me on Twitter, I might have something for you, but it's so unsupported I don't want a record of it. – Kris Gray Jul 16 '14 at 23:40
  • This is explains why retURL pointing to the home tab doesn't work from frontdoor.jsp too doesn't it? Solved a very weird mystery there. – ca_peterson Sep 18 '15 at 4:17
  • 1
    That is probably going to go through a separate system. I'm thinking with the new release this might work. – Kris Gray Sep 21 '15 at 20:40

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.