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
Ananya DhimanAnanya Dhiman 

how to display standard objects in one picklist in lightning component

Devi ChandrikaDevi Chandrika (Salesforce Developers) 
Hi Ananya,
Try this code
apex class

public class sobjectNames{
    
    public List<SelectOption> objects {get; set;}
    @auraenabled
    public static  string getName()
    {
        List<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();   
        List<wrapper> options = new List<wrapper>();
        for(Schema.SObjectType f : gd)
            if(f.getDescribe().custom == false) 
        {
            
            options.add(new wrapper(f.getDescribe().getLabel(),f.getDescribe().getLabel()));
            
        }
        system.debug(options.size());
        system.debug(options);
        string objectlist = json.serialize(options);
        return objectlist;
    }
    public class wrapper{
        public string label;
        public string value;
        public wrapper(string lab,string val){
            label = lab;
            value = val;
            
        }
    }
}

lightning cmp

<aura:component controller = "sobjectNames">
    <aura:attribute name="options" type="List" />
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <lightning:combobox name="progress" label="Status" value="inProgress" placeholder="Select Progress" options="{! v.options }"/>

</aura:component>

cmp.js

({
	doInit : function(component, event, helper) {
		var action = component.get("c.getName");
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                alert("From server: " + response.getReturnValue());
                var response = JSON.parse(response.getReturnValue());
                console.log(response);
                component.set("v.options",response );
            }

		
	});
        $A.enqueueAction(action);
}
})

Hope this helps you
If this helps kindly mark it as solved so that it may help others in future.

Thanks and Regards
Ananya DhimanAnanya Dhiman

Hi Devi, 

Thanks for your quick response. It helped. But now the requirement has changed. I need to display only 4 objects dynamically in the picklist i.e. Contact, Case, Opportunity and Account. And also when I click on the seletced object then I have to show another multi select picklist which will contain all the fields of that object.