Hi Anurag,
You should create schema for the picklist and call this method from component using aura init. this will fetch picklist value on loading the component.
public static List<String> getLeadStatus(){
List<String> options = new List<String>();
Schema.DescribeFieldResult fieldResult = lead.status.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
for (Schema.PicklistEntry f: ple) {
options.add(f.getLabel());
}return options;}
Java script controller code –
doInit : function(component, event, helper) {
var action = component.get(“c.getLeadStatus”);
var inputsel = component.find(“InputSelectDynamic”);
var opts=[];
action.setCallback(this, function(a) {
for(var i=0;i< a.getReturnValue().length;i++){
opts.push({“class”: “optionClass”, label: a.getReturnValue()[i], value: a.getReturnValue()[i]});
}
inputsel.set(“v.options”, opts); });
$A.enqueueAction(action);
}
For picklist –
<ui:inputSelect label=”Status” class=”dynamic” aura:id=”InputSelectDynamic” value=”{!v.leadObj.Status}” required=”true”/>