You need to sign in to do that
Don't have an account?

Data of Lead doesn’t redirect to the detail page current Lead
Hi!
I have lead table.

I need that when I click on the name of the lead, it opens the detail page current Lead.
The link seems to work, but the detail page current Lead does not open. Please tell me how to fix it.
My code:
Html:
<template>
<lightning-card title="Leads">
<lightning-layout multiple-rows="true" vertical-align="end">
<lightning-layout-item size="12" padding="around-small">
<lightning-datatable key-field="id" data={leads} columns={columns}></lightning-datatable>
</lightning-layout-item>
</lightning-layout>
</lightning-card>
</template>
Js:
import { LightningElement , wire} from 'lwc';
import getLeads from '@salesforce/apex/Qqq.getLeads';
const columns = [
{ label: 'Name', fieldName: 'Name', type: 'url',
typeAttributes: {label: {fieldName: "Name"}, tooltip: "Name", linkify: true} },
{ label: 'Title', fieldName: 'Title', type: 'text' },
{ label: 'Phone', fieldName: 'Phone', type: 'text' }
];
export default class LightningDatatableLWCExample extends LightningElement {
columns = columns;
leads;
@wire(getLeads)
wiredLeads(value) {
const {error, data} = value;
if (data) {
let leadData = JSON.parse(JSON.stringify(data));
leadData.forEach(record => {
if (record.LeadId) {
record.recordLink = "/" + record.LeadId;
record.LeadName = record.Lead.Name;
}
});
this.leads = leadData;
} else if (error) {
this.error = error;
}
}
}
I have lead table.
I need that when I click on the name of the lead, it opens the detail page current Lead.
The link seems to work, but the detail page current Lead does not open. Please tell me how to fix it.
My code:
Html:
<template>
<lightning-card title="Leads">
<lightning-layout multiple-rows="true" vertical-align="end">
<lightning-layout-item size="12" padding="around-small">
<lightning-datatable key-field="id" data={leads} columns={columns}></lightning-datatable>
</lightning-layout-item>
</lightning-layout>
</lightning-card>
</template>
Js:
import { LightningElement , wire} from 'lwc';
import getLeads from '@salesforce/apex/Qqq.getLeads';
const columns = [
{ label: 'Name', fieldName: 'Name', type: 'url',
typeAttributes: {label: {fieldName: "Name"}, tooltip: "Name", linkify: true} },
{ label: 'Title', fieldName: 'Title', type: 'text' },
{ label: 'Phone', fieldName: 'Phone', type: 'text' }
];
export default class LightningDatatableLWCExample extends LightningElement {
columns = columns;
leads;
@wire(getLeads)
wiredLeads(value) {
const {error, data} = value;
if (data) {
let leadData = JSON.parse(JSON.stringify(data));
leadData.forEach(record => {
if (record.LeadId) {
record.recordLink = "/" + record.LeadId;
record.LeadName = record.Lead.Name;
}
});
this.leads = leadData;
} else if (error) {
this.error = error;
}
}
}
here is my code. you can get some refrence from my code.
don't forget to mark it as best answer.
thank you
All Answers
here is my code. you can get some refrence from my code.
don't forget to mark it as best answer.
thank you
Thanks a lot!