I have a number of lightning:inputField that i'm setting based on certain criteria, these all work except for picklist field types. The code below shows how i am setting the fields. The country field is the picklist and the 2 alerts have the correct value in them, however the value is not getting set on country. Is there a different method for setting picklist fields?

var address = res.getReturnValue();
var country = component.find('Country__c');
var pcodeFld = component.find('Postcode__c');

if(country != undefined){
 country.set('v.value', address.Country);
if(pcodeFld != undefined){
 pcodeFld.set('v.value', address.Postcode);

EDIT: I can set a default value whilst using $A.createComponents using .set("v.value", "United Kingdom");

it just seems that i can't set it after the component has rendered based on some user action.

Reproduceable Example:

I just can't seem to set the value of any picklist fields when using lightning:inputField.


<aura:component implements="flexipage:availableForRecordHome, force:hasRecordId">
<div class="slds-p-bottom_large slds-p-left_large" style="width:500px">
    <lightning:recordEditForm aura:id="recordViewForm" 
        <lightning:messages />
        <lightning:inputField fieldName="FirstName" />
        <lightning:inputField fieldName="LastName" aura:id="lastname"/>
        <lightning:inputField fieldName="Birthdate" />
        <lightning:inputField fieldName="Phone" />
        <lightning:inputField fieldName="Country__c" aura:id="Country__c"/>
        <lightning:button label="Update" variant="brand" onclick="{!c.update}"/>


    update: function(component, event, helper) {
       component.find("Country__c").set("v.value", "Ireland");

  • Can you add markup as well, thanks. and is that lightning:input or lightning:inputField? Commented May 30, 2018 at 16:28
  • the markup is dynamically generated using $A.createComponents and theres a lot of it so its difficult to add here
    – paul
    Commented May 30, 2018 at 16:32
  • 1
    does same code work if component is not dynamically ? There are few issues with setter when components are created using $A.createComponents. salesforce.stackexchange.com/questions/196382/… Commented May 30, 2018 at 16:35
  • No, I just tried with a non-dynamic lightning:inputfield and the value still doesnt get set
    – paul
    Commented May 30, 2018 at 16:43
  • is your address.Country is in below format? var opts = new Array(); opts.push({label: results.Name, value: results.Name}); component.set("v.options", opts); If not then give label and Value in your Country Commented May 30, 2018 at 17:10


You must log in to answer this question.

Browse other questions tagged .