The Official Lookup Component

Flow now has a Lookup Component.

This component includes type-ahead search, and a list of recently chosen records. Here are the input parameters that you can pass in to it:

You configure it by pointing it at an existing Lookup field using the Object API Name and Field API Name fields. If you want to set its initial value, you can pass in a recordId, and you can make the field required.

Using Lookup Filters

You can make use of Lookup Filters with Lightning Flow. The filter does not (unfortunately) act before the list is rendered for the user. Instead it acts when the corresponding record is saved. Let’s walk through an example:

My Ships__c custom object has a Captain__c custom field that’s a Lookup to Contacts:

The Lookup control used on Flow screens is the same one used on Lightning record pages. Here’s what it looks like on a Lightning record page:

…and here’s how it looks on a Flow screen:

Suppose I add a Lookup Filter that filters out David Green:

One thing to note is that caching may cause it to take several minutes for the lists to update. I had to wait about 10 minutes after creating this Lookup Filter before David Green disappeared from the lists. However, effective immediately, if I selected David Green and tried to save the record in either a record page or via Flow, I would get an error message like this:

Once any caching refreshes, though, values that are blocked by the filter will not be visible in the Lookup

For more information, including info on OwnerId lookups, see https://unofficialsf.com/the-salesforce-automation-and-decisioning-wiki/14805/

Since this is an official component, consider posting questions and issues to the popular and well-monitored official community.

Subscribe
Notify of
guest
20 Comments
Inline Feedbacks
View all comments
Gabriel Hobbs

This is a great audition. I am looking to use this lookup field to help someone find an account name. I tried to configure the parameters on the screen component, but when I tried debugging the flow I could not see any input field. Could you help me see how I would configure the screen component for searching an account name?

Sir Deva Khalsa

Hey Gabriel,

I had this happen to me.

My guess is you’re using

Field API Name: Name
Object API Name: Account

The debug is not showing lookup choices because ‘Name’ is a text field on the Account object. You can re-configure to reference a Lookup field by using…

Field API Name: AccountId
Object API Name: Opportunity

Hope this helps!

Jeremy G

Hi – thansk for this – really helpful. I have a Custom Object (Subscription__c) which has a lookup of account (ie an account has many Subscriptions. In my opportunity I have a lookup to subscription – this has a filter (Subscription: Account ID EQUALS Opportunity: Account ID) So in my Opportunity lightning page, I can select an account – then only be presented in the lookup with Subscriptions for that account. I want to do similar in flow, but when I use Opportunity.Subscription lookup in flow, I get no values in my lookup (I assume because it doesn’t know the… Read more »

Anonymous

Hi ..Do you have any clue for the problem we are facing …
We have a requirement to have Dynamic Feild visibility in a registrtion form based selected country on community page. So we designed lightning flow with screen flow lookup component to give country list. This country lookup works fine within SF but not when added to community page.​​​​​​​

Ray Williams

Make sure your lightning component implements forceCommunity:availableForAllPageTypes, …” Also lookups and searches may work differently on community pages especially now ones that allow unauthenticated guest access.

Desmond

I can lookup an Account from my Case ok (filter issue notwithstanding).
But I do not appear to be able to look up a Case Owner (OwnerID) from my Case… (“Looks like you don’t have access to this field, or the object or field API name is not valid on this Lookup component. Contact your Salesforce admin for help.”)

Patryk

One issue I encountered which will not allow to switch to a standard lookup component:
Create a lookup on Account which will search for Accounts with given filter:
Source.Market equals Lookup.Market
If this flow is included on Account record, the source record market will always be null, therefore it will always return values where Market is not set, although it works when specific value is provided.
There is no alternative since we cannot pass any query condition to lookup component and we only depend on lookup field filters.

Matthew

My issue is the Flow account look-up works but it does not pass the value to the record it creates. The field it should populate is also a lookup which I thought may be the issue. I tried creating a standard text field to remedy this but to no avail. I’m open to any ideas.

Erik Peterson

Does the Flow look up element have the capability of a “global search” type look up? I have a screen flow that I want users to search for a specific object, but I want the flow on a home page. Not attached to any object specifically.

Simon Kinder

did this get changed with the last release? Seems to be messed up for me now. Get Apex errors on lookups and cannot save flow at all.

Alex Edelstein

Hi, Simon. Just to clarify: you’re talking about the custom Lookup component from here: https://unofficialsf.com/lookup/ ?

Simon Kinder

Hi Alex, no the official one. As of today it no longer works for me. I will have to revert to you earlier version. Basically the official one now no longer allows me to enter anything like before. i was trying to edit a flow made last week and now when i enter an object API name i get Enter a valid id error, same for field name and even display name…… Funny part is the flow still works, but i can’t edit it as i cannot get any of the look ups to work anymore and so cannot save… Read more »

Simon Kinder

What i see when i try to save the flow

TimeSheet (Screen Component) – The type for the input parameter “Record Id” doesn’t match the type for the assigned value.
Create_Time_Sheet_Entry (Create Records) – The field “TimeSheetId” isn’t compatible with the Apex element “TimeSheet”. “TimeSheet” can’t be a Apex.
refresh (Action) – The type for the input parameter “RecordId” doesn’t match the type for the assigned value.

Flow works fine (last week and today), but cant edit due to the above. Totally confused i am

Alex Edelstein

There weren’t any changes to the Lookup component in Spring ’20 so something else is going on here. Can you open a case with Support?

Simon Kinder

Thanks Alex,

With more testing it was working fine in sandbox and then….. this morning

Just to confuse everything it is working as expected. No idea what was going on yesterday, tried two different PC’s (at different sites as well) so it wasent some localised issue on this particular PC.

Thanks for the help.

Simon Kinder

This returned after a couple of days and official lookup component is broken currently for me (flows containing it still work, just cannot edit them as the errors stop saving completely).

Have logged a case (after initially being told we were not paying enough money to log a case on flows), have a support agent contacting hopefully this afternoon Aussie time.