public class LightningDataTableController{
@AuraEnabled
public static List<Contact> fetchAccountContacts(String accountId) {
List<Contact> lstContact=new List<Contact>();
lstContact=[select id ,Name,Email,Phone from contact where accountid=:accountId];
return lstContact;
}
}
({
doInit : function(component, event){
var contactAction = component.get("c.fetchAccountContacts");
contactAction.setParams({
accountId : component.get("v.recordId")
});
contactAction.setCallback(this,function(response){
var state = response.getState();
if (state === "SUCCESS" && response.getReturnValue() != '') {
var records =response.getReturnValue();
records.forEach(function(record){
record.LinkName = '/'+record.Id;
});
component.set('v.data',response.getReturnValue());
}else if(state === "ERROR"){
console.log('A problem occurred: ' + JSON.stringify(response.error));
}
});
$A.enqueueAction(contactAction);
}
})
Lightning DataTable : Lightning Web Component
LightningDataTableController(Apex Controller )
public class LightningDataTableController{
@AuraEnabled(cacheable=true)
public static List<Contact> fetchAccountContacts(String contactId) {
List<Contact> lstContact=new List<Contact>();
lstContact=[select id ,Name,Email,Phone from contact where accountid=:contactId];
return lstContact;
}
}
User Data Privacy User Data Privacy Our Chrome extension does not collect any personal data or user information. We are committed to respecting your privacy and ensuring a secure browsing experience. You can use our extension with confidence, knowing that your data remains private and secure. If you have any concerns or questions regarding privacy or data security, please feel free to contact us at sanjayibirds2013@gmail.com .
Salesforce LWC : Compact Layout showing on Hover Sometime we have requirement to show Account name link on standard views, a popup with the Compact Layout shows the details of that record. LWC Parent Component : Template (HTML Code) LWC : JS (Process Code) import { LightningElement,api } from 'lwc'; export default class AccountComponent extends LightningElement { @api recordId; @track objRecordId; handleMouseover(event) { console.log(this.recordId); this.objRecordId = null const toolTipDiv = this.template.querySelector('div.ModelTooltip'); toolTipDiv.style.opacity = 1; toolTipDiv.style.display = "block"; // eslint-disable-next-line window.clearTimeout(this.delayTimeout); // esli...
Comments
Post a Comment