function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
FreddySFreddyS 

prepopulate lightning lookup component

Hi all!
Im stuck on this problem with a custom lightning lookup component. I used the link below as a guide to create a custom lookup component where I can search for records with any object. 

Using the blog below, how can I prepopulate the lookup component based on the current record its on? For example, if i make this component code for code from the link below and the lookup is for the Account object, how can I prepopulate the lookup if I put this component on the account lightning page? This is tricky for me and I'm sure someone out there can help me as they know more about how lightning components work!

Thanks in advance to those who are willing to point me in the right direction!! 

http://sfdcmonkey.com/2017/07/17/re-usable-custom-lookup/
Alain CabonAlain Cabon
Hi,

sfdcmonkey.com is a great blog but the complicated problem of the lookup component needs more code.

An Ukrainian team has developped an "universal" lookup component (in flows?). It is still free but you don't have access to the source code.

Lightning Universal Lookup Component (works for the mobile app, rare)
https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000ErH8PUAV  (https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000ErH8PUAV )

User manual: 
https://docs.google.com/document/d/123mGfVHhSDDchXNHVpdVW-lQvN1bXD3UWaZC1-rMxqg/edit
FreddySFreddyS
I appreciate the resource, but Im trying to create my own lookup component that I can reuse myself and I do not want a managed package from another source. Are there some pointers you can give me on where to start about pre populating this lookup based on the current record Id? Where should I begin?
Alain CabonAlain Cabon
Hi,

There are many projects on github.

Philippe Ozil's lookup:   https://github.com/pozil/sfdc-ui-lookup

About:  This is a generic & customizable lookup component built using Salesforce Lightning (Aura) and SLDS style.
It does not rely on third party libraries and you have full control over its datasource.

Salesforce Developers Blog:
https://developer.salesforce.com/blogs/author/pozil

It is a better choice to have the source code indeed (no risk of a commercial version in the future without the possibility of updating the code ourselves).