I am trying to auto populated a lookup field using the force:inputfield but its not working, is there some specific way to populating as other types of field are working fine like picklist, text, date & checkbox

Here is the code


<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:attribute name="recordId" type="Id"/>
<aura:attribute name="account" type="Account" default="{ 'sobjectType': 'Account' }"/>
<!-- lookup to lead on account object -->
<force:inputField aura:id="accNe2" value="{!v.account.Lead__c}"/> 

Here is the controller

doInit: function(component) {

    var action = component.get("c.getAccountFieldValues");
    action.setParams({ recordId : component.get("v.recordId") });
    action.setCallback(this, function(actionResult) {
        var infos = actionResult.getReturnValue();
        component.set("v.account", infos);             

And the apex method has normal SOQL returning account record.

  • This looks fine. What exactly does not work? What type is the Lead__c field? Aug 27, 2017 at 5:10

1 Answer 1


My assumption is that Lead__c is of type "Lookup" even if you did not explicitly stated so.

Now I can see two possible reasons:

  • force:inputField may be still buggy with Lookup-fields. There where so many bugs in the past with force:inputField in general and Lookups in particular that I wouldn't wonder.
  • if you hold in your Lead__c an relation to the lead out of which the Account has been converted (fishing in the dark, this is again only an assumption since your questions isn't clear on that) the fact that the lookup points to an converted lead might be the reason. Converted leads behave differently in many ways.

To narrow it down you should state your field type. If field type is Lookup, try to create another test-lookup field on Account e.g. looking up contacts and test-populate it on your test record using the standard UI to ensure it is populated correctly. Now change your compo for testing to this new lookup field instead of Lead__c. If this still doesn't work I think it's a bug in force:inputField

  • Thanks Uwe, modified the query according specified that issue is in only lookup field. But its not because of the Lead object only, I've tried using a custom object as well, but force:input field doesn't support lookup auto-population. Aug 27, 2017 at 17:39

You must log in to answer this question.

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