9

Hi I'm using jQuery mobile to render records and on each link I want to just redirect to the record view page. I'm using sforce.one.navigateToSObject on the href attribute, which works fine. But when I click on the back arrow on the record page, it takes me back to the home page of the lightning app, instead of the custom page that displays the records. Any ideas?

1 Answer 1

0

You'll want to look at the Managing Navigation Section of the Salesforce1 Mobile App Developer Guide, particularly Navigation with the sforce.one Object.Tthe back button works differently in Salesforce1 than in the standard platform from a regular browser. Your code will need to be adjusted to take this into account.

As an example, here's what it says about back(​[refresh]) navigation:

Navigates to the previous state that’s saved in the sforce.one history. It’s equivalent to clicking a browser’s Back button.

refresh is optional. By default, the page doesn’t refresh. Pass true to refresh the page if possible.

Now, you're using navigateToSObject(​recordId​[, view]) to get to a Lightning Page. Here's what it says about that command:

Navigates to an sObject record, specified by recordId. This record “home” has several views, which in Salesforce1 are available as slides that the user can swipe between.

view is optional and defaults to detail. view specifies the slide within record home to display initially. The possible values are as follows.

  • detail: the record detail slide
  • chatter: the Chatter slide
  • related: the view of related slide

Okay, you're probably wondering why I'm telling you all this. The reason being that the above command is obviously intended for use to get to a standard Object view and was never intended to get to a Lightning page to view an Object record.

If you look at how Lightning Components are being implemented on the platform, they're being implemented via Actions. If you use an Action to get to your Object view I strongly suspect your back button will return you to your previous view on the Lightning page.

2
  • Thanks. The VF page with the urls pointing to the record page via navigateToSObject is actually opened from an action on the lightning page. So navigateToSObject takes to the record view page, the back button on the record view page supposedly should take back to the lightning page, but it's not. It's going back to the Salesforce1 home page. Commented Jul 20, 2015 at 20:26
  • When you say "Action" do you mean a Lightning Event Action or do you mean a " Custom Salesforce Global or Object Action"? If the former, we're not talking about the same thing and I'd ask how you were implementing it? If the latter, then we're on the same page and I'd recommend you file a case with Salesforce Support.
    – crmprogdev
    Commented Jul 20, 2015 at 21:59

You must log in to answer this question.

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