Contact Us:

670 Lafayette Ave, Brooklyn,
NY 11216

+1 800 966 4564
+1 800 9667 4558

There are lot of custom lookup components are available which we can use in the aura component. These custom lookup components are pretty good but there are some limitations with them like not showing the results based on the lookup filters and also doesn’t work with multi-lingual screens.

I tried to come up with a work-around and I hope you may find it useful too. You just need to create an aura component and an event to use this workaround.

As you see in the code CustomLookupStd.cmp, I am using the Lightning:recordEditForm and just showing the lookup field. It’s allowing users to select the record and an event is getting fired to update the parent component.

You just need the following code snippet to use this lookup.

<c:CustomLookupStd
  childObjectName="Contact"
  selectedRecordId="{!v.projectId}"
  fieldName="Project_in_Contact__c"/>

childObjectName : It is the API Name of the object where lookup field is available.
selectedRecordId: Record Id of the selected record if you want to set the lookup record on the page load.
fieldName: API Name of the lookup field.

I hope it make sense to you. Please feel free to ask your questions in the comment box.

2 Comments

  1. By
    January 21, 2020

    Love the blog. Thanks for this, however I do have a question. What is the projectId in your scenario. I am trying to replicate this and cannot get the input to save to an attribute to submit to the DB.

  2. By
    January 21, 2020

    Also, how do you add more than 1 lookup to a component?

Leave a comment

Your email address will not be published. Required fields are marked *