Lightning Lookup component in a flow - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Anthony BernardAnthony Bernard 

Lightning Lookup component in a flow

Im currently trying to do a lookup to the account object within a flow. 

When I go to debug my flow and I type something in the lookup area, no results show up. 

What could I be doing wrong ? 

User-added image

User-added image
Best Answer chosen by Anthony Bernard
Deepak AnandDeepak Anand
Do it like this = 
User-added image

All Answers

sakshi nagpalsakshi nagpal
Hi Anthony,

Can you share your code?
Anthony BernardAnthony Bernard
Hi sakshi, 

Im not dealing with any code, just using the flow builder. Is there a specific place I can go to get code for you to see? 

User-added image
User-added image
Deepak AnandDeepak Anand
Do it like this = 
User-added image
This was selected as the best answer
Anthony BernardAnthony Bernard
Thanks Deepak, that works!. Is there a way for me to display additional fields next to the account name? 

Im trying to get the search results to show as Account name + Member Number + Branch number
Anthony BernardAnthony Bernard
I see its showing the member number already, where can I go to change this configuration to add the branch number? 
User-added image
Anthony BernardAnthony Bernard
Thank you. 

I just have one last question. When I go to the search layouts page, I see a lot of fields selected for different search layouts. But within my flow I only see the Member # field displayed under the account name. 

Am I looking in the right place? 

User-added image
Deepak AnandDeepak Anand
That's because - 
User-added image
Jason FinkJason Fink
Deepak, do you have a link to Flow Builder Lookup Component documentation (existing SF Help doesn't show it)?  I utilized your answer above to return all Accounts.  Can I filter this or a subsequent lookup?  I'd like a user to make a lookup choice for Accounts, then a lookup on Contacts only related to the selected Account.  Is this possible with FB Lookup?  I previously used Record Choices and Picklists but this would be a great replacement.
Deepak AnandDeepak Anand
Jason - No, you cannot do that :-(
sakshi nagpalsakshi nagpal
Hi Jason/Deepak,

 If you want to fetch account records in flow with specific criteria you can always query that in flow.
Sorry if i didnt understand the requirement correctly.

thanks
Jason FinkJason Fink
Thanks Deepak.  Maybe in a future release.
Sakshi - we're refering to the Flow Builder's Screen element's Lookup component that was added with Winter '20, as shown in the OP's post.  Different from Get Records or Record Choices.
Jim PoteetJim Poteet
I'm confused why if I want a list of Accounts I'm searching the contact object. What if I want to lookup contacts?
John McIntoshJohn McIntosh
I'm with Jim Poteet - Iim trying to get it to perform a lookup on contacts and for the life of me cannot get it to filter / show the right data. The Contact lookup for an account seems odd logic
John McIntoshJohn McIntosh
Actually just got it - You need to find an object that has a lookup field to a contact - in our case we have a custom object called Software Contract and we have a couple of lookup to contact fields - one is End_User__c
I tested this thinking it would only return contacts that had been populated in that field but it turns out it looks up all contacts. happy days!
User-added image
Kausar ShaikhKausar Shaikh
Hello Everyone,
I am trying to define a lookup to Asset object on my screen but it's not pulling any results. I tried to set the Field Api Name to "Name" , "Asset" . It's not working. Any idea what am I missing ? 
Lookup Component
Deepak AnandDeepak Anand
You can utilize the self-lookup to Asset itself (ParentId) - 
User-added image
User-added image
Kausar ShaikhKausar Shaikh
Hello Deepak,
It's not recognizing ParentId ..Here's the screenshot. My use case is to auto launch this flow from a case where users are requested to capture additional details when an attribute is true. One of the fields to capture is Machine serial#.User-added image
Deepak AnandDeepak Anand
Can you check the FLS (Field Level Security) of that fields - Parent Asset ?
Kausar ShaikhKausar Shaikh
Deepak, My lookup is working. I was incorrectly populating the lookup component attributes . AssetId worked .
Thanks for all your prompt responses
 
Nathalia Caicedo SolarteNathalia Caicedo Solarte
@Josh and @Derek thanks for your answers, have been really helpful, however it hasn't really work for me in certain way, I only need a lookup to Accounts that are Business Organizations so I used the Affiliation object and the field hed__Account__c that is an actual lookup to accounts of that specific record type but my result is an error message "Looks like you don't have access to this object, or the object API name is not valid on this Lookup component. Contact your Salesforce admin for help." I'm Admin and I have access to that object and field so I guess that is not the Issue. Hope you can help me to find out what's happening 

Again thanks for your answer 
Best Regards
Nata
Jim RiggioJim Riggio
I am getting this same error and can't seem to find a way around it
Tyler BurnettTyler Burnett
Has anyone found useful documentation out there for that explains the Lookup Component?
Rogerio Borges GriloRogerio Borges Grilo

I'm also searching for USEFUL documentation out there that explains the Lookup Component... Particularly on how to lookup Custom Objects. Meanwhile, here are some links that may help others:

https://unofficialsf.com/the-new-lookup-component/ 

https://jenwlee.com/2019/11/13/look-it-up-in-a-flow-screen/ 

Dmitry YudinDmitry Yudin

I added a lookup and trying to search by Name - it is working.

But when trying to search by another field - no result, despite this field is presented on the search layout. And also when doing the same with the real lookup on the record page (not in the flow) - it is working for any field from the search layout.

 

So, seems like a bug and salesforce flow lookup component doesn`t imitate the real lookup field at the full scope.

Wolf DuttlingerWolf Duttlinger
Hi, just adding to this, because I stumbled of some issues.

Background: I want a flow that creates a new event. So I have an event record variable in the flow.

I want the user to chose the account. Using a lookup component for this.

I did first try - as apparently many did - sObject = Account. Fail!

Then I tried sObject = Event and Field = AccountId. This did lead to error message of "Object Event is not supported in UI API". Sh....

Finally I did set sObject to "Contact" (and Field to AccountID) which did the job. ALTHOUGH there is no contact in my flow... Just using a DUMMY sObject that has a "working" lookup relationship... Which drugs did this developer take??
Rogerio Borges GriloRogerio Borges Grilo
@Wolf Duttlinger
that didn't work for me. can you post a screenshot? 
Wolf DuttlingerWolf Duttlinger
Flowbuilder - Setting of screen component to lookup account
@Rogerio Borges Grilo - I hope this helps....
Anugrah SrivastavaAnugrah Srivastava
@Jason Fink , @Deepak Anand
Even I was trying to get a second lookup which can fetch the records based on the 1st lookup values. In Jason's case it was Account 1st and then select the contacts for that account.
Seems it is not possible for now.
However what I did was to get the Id of the record from the 1st lookup and then in a subsequent screen create a record list using the Id fetched from previous lookup.
Not the best way to do it, but it might work.
Katia MottaKatia Motta
Hi everybody, I am happy to read that I am not the only one struggling with the Lookup Component! :)
Step by step I am trying to solve the problem and what you have written above has helped me find some solutions.
In my case, I am trying to build a process to copy opportunity products into orders.
Order is customized. I have created a lookup field to search for the order opportunity from which products shall be copied. I have managed to create the field which looks up into opportunities. However, as I type the opp name, no preview appears to select from. And despite my typing, no value is held by the field. What am I doing wrong? Or maybe what is missing?
This is my lookup field:
User-added image
Thank you in advance for your support.
Rogerio Borges GriloRogerio Borges Grilo
Unfortunately, the Lookup Component is not intuitive enough at the moment. I have several potential use cases for it but my team has to fall back to custom development for the time being. I hope this component gets enhanced soon on the next few Salesforce releases. Huge potential here, but hard to use it right now on the Flow Builder.
Michael KearneyMichael Kearney
@Katia Motta I was having a similar problem, where the lookup component wouldn't return any results and gave me the Select an option or remove the search term message when entering a value. I definitely had the component set up correctly, which was a lookup to a custom object. Perhaps this is the same problem you experienced.

The reason for this problem was that I had a lookup filter on the lookup field in my source object. When I deactivated the lookup filter, the lookup screen on the Flow worked fine (though without the filter I wanted).

The particular filter I was using referenced another lookup field, looking up to Contacts. It requiring that only records related to the Contact previously selected on the record be available in the lookup. Perhaps other types of filters that don't reference another lookup field wouldn't have this same problem in the Flow.
Katia MottaKatia Motta
Thank you @Michael Kearney - in the end I have deleted the Lookup component and gone for another autolaunched flow solution. 
Matt WiesenbergMatt Wiesenberg
I am having a problem where the lookup does not hold the value entered when using conditional visibility. If the lookup is always visible there is no problem and works as intended. However, if shown due to set condition, the value I entered will be dropped and will be passed through as NULL.