+ Start a Discussion
@ M  Coder@ M Coder 

Display lookupfield and picklist values in Lightning datatable - LWC

how to a display lookupfield and picklist values in Lightning datatable - LWC??? 

Any sample code please
AnudeepAnudeep (Salesforce Developers) 

The following examples are taken from below posts 



To display lookup field, include the lookup field from the object and add it to the response
public with sharing class GetAllOpportunities {
    public static List<DataTableWrapper> getAllOpps() {
        List<Opportunity> listOpp = [SELECT Id, Name ,StageName, CloseDate 
                                     FROM Opportunity Order By Name asc];

        List<DataTableWrapper> response = new List<DataTableWrapper>();
        for(Opportunity opp : listOpp){
            DataTableWrapper obj = new DataTableWrapper();
            obj.oppId = opp.Id;
            obj.name = opp.Name;
            obj.nameUrl = '/'+opp.Id;
            obj.stageName = opp.StageName;
            obj.closeDate = opp.CloseDate;

        return response;

    private class DataTableWrapper {
        public Id oppId {get;set;}
        public String name {get;set;}
        public String nameUrl {get;set;}
        public String stageName {get;set;}
        public Date closeDate {get;set;}


​​​​​​For picklist values, you can refer to the below sample code
    public static List<String> getPickListValuesIntoList(){
        List<String> pickListValuesList = new List<String>();
        Schema.DescribeFieldResult fieldResult = Account.Rating.getDescribe();
        List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        for( Schema.PicklistEntry pickListVal : ple){
            System.debug('Values in Rating are: '+pickListValuesList);
        return pickListValuesList;

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. Thank You!

@ M  Coder@ M Coder
hi , 
I need working full sample code  please