Lookups are very important components in Salesforce. Salesforce vide inputfield to handle the Lookup component out of the box. But they come with there own set of limitations. So today I have created a basic Lookup Lightning Component which we can easily use with our existing apps or component to make it work.
I tried to keep this component as simple as possible so I did not use any event to communicate data between component. Instead we have used two way binding to pass data between component. Also we have not used any third party library and only SLDS is used. So it will work in Locker service and can pass security review as well.
Here is the complete code.
Now this component support Dynamic Icon , Required, Dynamic Label. I will also add many other feature in this component to make it more better. You can also download complete code from Github repo as well.
Did you like this component or want to add any feature, report any bug. Just let me know in comments section. Happy Programming :).
I cannot get this to work. I am trying to use it in a sandbox to lookup accounts and I have entered sample data.
Check in console if you are getting any error. Share the error message if any.
Hi,
this works perfectly and it is a very good solution. I used the component as an input field on Account Object to a custom object.
However, I have an extra requirement where i need:
When editing the Account i need to display the selected value by the user on that account. I cannot find a way? Could you please help ?
Hi George,
Yes just pass the value in attribute and it will get prepopulate when it load.