function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
VintaraVintara 

Lightning enabled site, sforce.one.navigateToSObject() fails.

Seems that all our sandboxes have Lightning enabled, so far this has not caused any major issues. However, I am finding that sforce.one.navigateToSObject('{!RecordId}') does not work. It does not generate any errors, it just fails to navigate to the object. I can replicate the navigation behaviour I want by using generic javascript...

window.location="/one/one.app#/sObject/{!orderId}/view"; 

But this causes the SF1 logo to display before the object loads. Which is slow.

Any ideas?
Best Answer chosen by Vintara
VintaraVintara
@Kim Hellbom 
Figured it out! The JavaScript API methods work, but now only if you pass an 18 character ID. 15 character IDs will fail without error.

All Answers

Kim HellbomKim Hellbom
I have the same issue in my Lightning enabled sandbox.

Navigating to a record with sforce.one.navigateToSObject(recordId) from a custom visualforce page just causes the page to refresh. 
Salesforce 1 is wrapping the visualforce page in an iframe, which might be causing the issue. Not sure if this is standard behaviour? Exact same code works fine in a Summer15 sandbox, where the page is not being iframed.
VintaraVintara
Well at least it's not just me... however I am no closer to a solution to this problem. Worse case I can use window.location, but that's inelegant.
VintaraVintara
@Kim Hellbom 
Figured it out! The JavaScript API methods work, but now only if you pass an 18 character ID. 15 character IDs will fail without error.
This was selected as the best answer