Print this page

Visualforce navigation methods and page references in Salesforce1

Knowledge Article Number 000212840
Description

 

When you're developing navigation methods for Salesforce, it's important to understand the different development approach required for Salesforce1 and the Salesforce experience for desktop web browsers.

Resolution

 

Salesforce1 JavaScript library 

 

Salesforce provides a library of JavaScript which can be used to develop for navigation within the Salesforce1 app. This library is the only supported method for navigation within the Salesforce1 app.   

 

"Page Reference" class for Visualforce in Salesforce1 

 

While developers can use the "Page Reference" class to control navigation for the full site, it isn't supported for Salesforce1, may not work as expected, and Salesforce Support is unable to troubleshoot issues from the use of the class. Some pages will load using page references, but that may change with any update.

The Salesforce1 Development Guide references the use of our provided sforce.one navigation functions in Salesforce1, but it may not be clear that Page References aren't supported.

If you're a developer, consider the following:

 

  • You must rely on the client-side JavaScript navigation functions provided through the sforce.one object which is included automatically when a Visualforce page is accessed via Salesforce1. These functions are outlined in the Development Guide.
  • You can do a quick check to see if a user is coming from Salesforce1. If they are, you can use the sforce.one navigation functions. If they aren't, use the standard navigation methods for the full site instead.
  • You can pass parameters in a URL to a custom Visualforce page by using the sforce.one.navigateToURL function. If you're navigating to a standard Salesforce1 page, you won't be able to pass parameters to pre-populate fields, such as when using the sforce.one.createRecord or sforce.one.editRecord functions.




promote demote