March 15, 2018

lightning:recordEditForm with lookup field

Lightning Component Code:

<aura:component implements="flexipage:availableForAllPageTypes,force:appHostable" >
    
    <lightning:recordEditForm recordId="0031I000008YCvoQAG" objectApiName="Contact">
        <lightning:messages />
        <lightning:inputField fieldName="FirstName" />
        <lightning:inputField fieldName="LastName" />
        <lightning:inputField fieldName="Email" />
        <lightning:inputField fieldName="AccountId" />
        <lightning:button class="slds-m-top_small" variant="brand" type="submit" name="update" label="Update" />
    </lightning:recordEditForm>
    
</aura:component>

Output:


6 comments:

  1. Hi, do you know how to fix accountId field label? It shows "Account ID" instead of "Account Name".

    ReplyDelete
    Replies
    1. As of now, you don't have attribute like label to replace it.

      Delete
    2. Still not supported. Create an idea in Salesforce Idea community.

      Delete
  2. Can we use visualforce page to have the lightning input look up field?

    ReplyDelete
    Replies
    1. You can Use Lightning Components in Visualforce Page. Chec this https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_visualforce.htm

      Delete