Is there an out-of-the-box solution to populate record-type specific picklist values when creating a picklist dynamically (in a Lightning Component) that references an sObject field?

At this point it looks like all picklist (ui:inputSelect) values must be created as ui:inputSelectOptions and will not populate dynamically. This is problematic for record types since we can't get record-type specific picklist values from the server-side controller.

Also, thoughts/best practices for handling dependent picklists?

Your insights are appreciated.

  • 1
    I assume there is/will be a solution for record-type specific picklist values in Lightning components. For an Angular app I used this approach as a work-around for the lack of API Picklist values by record type for AngularJS UI.
    – Keith C
    Commented Jun 9, 2015 at 15:44
  • Thanks @KeithC. I've done the same in Angular but would really like to see a native Salesforce/Lightning solution for this. Will build it if necessary :)
    – sagacious
    Commented Jun 9, 2015 at 16:46
  • Picklist Support was one of the items on the Lightning Data Service roadmap slide at DF17 Commented Dec 5, 2017 at 14:16

2 Answers 2


After switching from ui:inputSelect to lightning:select , I was able to use the standard html options.


<aura:attribute name="options" type="String[]" />
<aura:handler name="init" value="{!this}" action="{!c.doinit}" />
<aura:attribute name="selectValue" type="String" />
<lightning:select aura:id="myselection" value="{!v.selectValue}">
<aura:iteration items="{!v.options}" item="option">
<option value="{!option}">{!option}</option>



I did it using ui:inputSelect on creating lightning component dynamically. Here is the codes:

On controller I put options parameter and fill it datas as in value & label.

var file = component.get("v.file");

component.set("v.fileCreatedByName", file.file.CreatedBy.Name);
var dynamicComponentsByAuraId = {};
for (var i=0; i<file.keyValueMap.length; i++) {
    var field = file.keyValueMap[i];
    var uiCmp = helper.cmpMap[field.fieldType];

    if (field.updateable){

        if (field.fieldType == "BOOLEAN")
            field.value = field.value == "true";

        var cmpAttr = {
            "aura:id": field.key,
            "label": field.label,
            "value": field.value

        if (field.fieldType == "PICKLIST" || field.fieldType == "MULTIPICKLIST") {                    
            var options = [];
            for (var prop in field.options)
                options.push({value: prop, label: field.options[prop]});
            cmpAttr["options"] = options;

        if (uiCmp.hasOwnProperty("attributes"))
            for (var prop in uiCmp.attributes)
                cmpAttr[prop] = uiCmp.attributes[prop];

            function(newCmp, status, errorMessage){
                //Add the new button to the body array
                if (status === "SUCCESS") {
                    var body = component.get("v.body");
                    dynamicComponentsByAuraId[newCmp.getLocalId()] = newCmp;
                    component.set("v.body", body);
                else if (status === "INCOMPLETE") {
                    console.log("No response from server or client is offline.")
                    // Show offline error
                    else if (status === "ERROR") {
                        console.log("Error: " + errorMessage);
                        // Show error message

component.set("v.dynamicComponentsByAuraId", dynamicComponentsByAuraId);

On the Apex side, I pull picklist options as below:

if (field.fieldType == 'PICKLIST' || field.fieldType == 'MULTIPICKLIST'){

    Schema.DescribeFieldResult plistDescribe = Schema.getGlobalDescribe().get(config.objectFilePrefix + config.objectFileName).getDescribe().fields.getMap().get(field.fieldId).getDescribe();                        
    List<Schema.PicklistEntry> plistOptions = plistDescribe.getPicklistValues();

    Map<String, String> options = new Map<String, String>();
    for( Schema.PicklistEntry plo : plistOptions) {
        options.put(plo.getValue(), plo.getLabel());
    keyValueMap.add(new KeyValueMap(field.fieldId, field.fieldLabel, (fieldValue == null) ? '' : fieldValue, !(field.fieldType == 'TEXTAREA' || field.fieldType == 'MULTIPICKLIST'), field.fieldUpdateable, field.fieldType, options));

Thats all! It is written for custom objects' custom fields.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .