Showing a lookup field in aura component which respects the lookup filters and gives you the standard lightning experience

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.

Have a look at the following code snippets for the component and event.

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.


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.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.