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

NavigatetoSobject not working in lighting

Hello friends,
When i tried navigating from the lightning app page to the record detail page, using the Aura function it fails.
​createRecord : function (component, event, helper) { var navEvt = $A.get("e.force:navigateToSObject"); navEvt.setParams({ "recordId": "00QB0000000ybNX", "slideDevName": "related" });; }

Is there something i am missing here?

Your inputs are appreciated.

hI Roh
are you trying to naviagte to Lightning App ( page to record detail page ? if yes so 
this event is only supported in Lightning Experience and Salesforce1 only. 
add your lightning component to Lightning App builder or salesforce1 tab or lightning experiences page layout and then check it 
i hope it helps you 
let me infrom if it helps you
Mike HatchMike Hatch
I'm having a similar error, after following the Trailhead lesson explicitly. The call to $A.get("e.force:navigateToSObject") returns 'undefined' when used from the version of the app displayed from the developer console (click on 'Preview').  If I navigate to the app via <mysandboxurl>/one/ then it works properly - so the lab instructions are incorrect in instructing me to view the app by launching from the developer console (or the developer console should launch the correct version).
David Roberts 4David Roberts 4
Also, it works on the mobile device but not the desktop/laptop. What does work and what is the test for mobile or not?
If {mobile){
    use e.force:navigateToSObject}
    use a different function?
Mahima GuptaMahima Gupta
Try to add
<aura:dependency resource="markup://force:navigateToSObject" type="EVENT"/>
I am trying to naviagte to record detail page in Lightning App (
Is there any way to do that?