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
Øyvind Borgersen 10Øyvind Borgersen 10 

Lightning component navigate to record

Hi,

I've created a lightning component as a list view of cases. From that listview I have a button which should navigate to the record on the listview.
I've tried a couple of version with :navigateToUrl without any luck.

How do I create the controller which navigates to the selected record?

 
Best Answer chosen by Øyvind Borgersen 10
Raj VakatiRaj Vakati
You can do it by using  lightning:navigation

Refer this link 
https://sushilkumardeveloper.wordpress.com/2015/09/09/open-a-record-create-or-edit-page-or-navigate-to-a-record-in-salesforce-lightning/
https://wedgecommerce.com/lightningnavigation-lightning-component/
https://andyinthecloud.com/2017/05/30/overriding-standard-actions-with-lightning-components/
https://force-base.com/2016/01/04/how-to-navigate-from-one-component-to-another-in-lightning/
https://rajvakati.com/2018/05/29/navigation-in-lightning-experience-using-pagereference/
https://wedgecommerce.com/lightningnavigation-lightning-component/
 
ge : function(component, event, helper) {
        var navLink = component.find("navLink");
        var pageRef = {
            type: 'standard__recordPage',
            attributes: {
                actionName: 'view',
                objectApiName: 'Contact',
                recordId : '0037FXXX51uq5QAA' // change record id. 
            },
        };
        navLink.navigate(pageRef, true);
    }