+ Start a Discussion
suneel kumar 32suneel kumar 32 

How to display an input lookup field in lightning component

 I need to display lookup field while creating a record from Lightning component so that user can select associated account lookup while creating contact record.
hi suneel Kumar 
you can create lightning lookup field 
go to the bleow link for you solution 

Mark it best answer if it helps you :)
Javier Chaos 5Javier Chaos 5

A much complete and functional version can be found here (https://github.com/Chaos-Tech-Corp/Input-Field-Lookup).

lookup component focused

As simple to use as:


    <aura:attribute name="selectedId" type="String" />
                    label="Relate to"

Eli Haugen 2Eli Haugen 2
Javiar, I'm getting an error when trying to save the lightning component that says "Failed to save lookupField.cmp: No EVENT named markup://c:selectedsObjectRecordEvent found : [markup://c:lookupField]: Source"
Any idea why that might be? 
Javier Chaos 5Javier Chaos 5
Hello Eli,
Apologies I forgot to include one file for the event in the repository. It's up to date now and you shouldn't have that error anymore.
Eli Haugen 2Eli Haugen 2
That worked perfectly. Thank, Javier!
Kristjan MarianoKristjan Mariano
Hi Javiar, great component! But I'm just wondering why does it not let me create a record whenever I click New Account? Is there something wrong?

Reshma Shaik 34Reshma Shaik 34
Hi Javier, 
your code really helped me a lot . Thank you so much . But m getting error when i click on New Account. Can you please help me with that.
The error mesg i got is : Action failed: c:lookupField$controller$createNewRecord [Cannot read property 'setParams' of undefined] Failing descriptor: {c:lookupField$controller$createNewRecord}

Uma YarlagaddaUma Yarlagadda
Hi Reshma,

Are you able to find out solution for Cannot read property 'setParams' of undefined] Failing descriptor: {c:lookupField$controller$createNewRecord} issue?