Wednesday, December 4, 2019

Hyperlinks in Lightning-DataTable To Open The Record Detail Page In Classic Console

In my previous post we have seen how to open record detail page directly from the lightning data table .If the same thing you wants to do it in Classic Console where your visual force is loading the LWC component then that will not work.

Please do the below changes to work the same in Classic console as well.The major change involves at Url param and target param in columns section.

Change the target attribute to '_top' and append the console#%2F in the redirection url


import { LightningElement ,wire,track} from 'lwc';
import getAllOpps from '@salesforce/apex/GetAllAccountsCntrl.getAllAccounts';

export default class AccountListTable extends LightningElement {
    @track columns = [
            label: 'Account Name',
            fieldName: 'nameUrl',
            type: 'url',
            typeAttributes: {label: { fieldName: 'Name'}, 
            target: '_top'},
            sortable: true
            label: 'Account Source',
            fieldName: 'AccountSource',
            type: 'text',
            label: 'Website',
            fieldName: 'Website',
            type: 'text',
            label: 'Close date',
            fieldName: 'closeDate',
            type: 'date',


    @track error;
    @track listAccsData = [];

 wiredAllAccounts({ error, data }) {
        if (data) {
            this.listAccsData = => Object.assign(
                { "nameUrl": '/console#%2F'+record.Id},
        else if (error) {
            this.error = error;
            this.listAccsData = null;

Hope this helps you..Enjoy..!

No comments:

Post a Comment