Lookup Screen Component in Salesforce Lightning Flow

Lookup Screen Component in Salesforce Lightning Flow

Lookup Screen Component in Salesforce Lightning Flow: Salesforce has released a new screen component – Lookup. As the name suggests, this new screen component lets users search for a record in a flow just like a lookup field in Salesforce.

Before this, the only option to select a record in the flow was to use the picklist screen component and each picklist value will denote a separate record of an object.

Using the lookup screen component users can easily search and define the record in the flow and you can also set the current recordID or default value in the lookup field in the flow so that users don’t have to select the record every time they are running the flow from a record.

How to Use the Lookup Screen Component in Salesforce Lightning Flow?

Let’s consider a use case where you need to create a screen flow and want to get some input from the users. And once the flow is executed you want to create a record from the user’s inputs and get it related to a parent object.

In my case, I have a survey object which has a lookup relationship with the account. On the account page, I want the users to go through a set of screens and then the flow will create a Survey record and show as a related list on the account page once the flow is executed. For that, we need to link the survey record to the account record by mentioning a value on the lookup field in the flow.

Lookup in Salesforce Lightning Flow

In the above screenshot, I have added a lookup field by the name of Account since I want to display the account records in my lookup field.

Field API name – Enter the API name of the field which is a lookup field to the object of which you want to show the records. In my survey object, I have a field by the API name AccountName__c which is a lookup to accounts.

Label – Field label of the lookup field which appears on the flow screen.

Object API name – The API name of the source object. The object where the field API name is present.

Record id – Record ID value for the lookup. You can mention the current record id so that by default the lookup field shows the current record from which the flow is executed.

Require – Requires users to enter a value before they can move to the next screen.

Lookup Component in Salesforce Flows

Store lookup values in the flow

When you add a screen component to flow, the values are automatically stored in a variable. When the user navigates to the next screen, the values are assigned to the flow variable.

To store values manually, select manually assign variables (advanced).

All attributes are available to store inflow variables, but most likely you must store this attribute.

Record ID The ID of the record that the user selects.

You can store this value in a text variable.

Record Name The name of the record that the user selects.

You can store this value in a text variable.


Permanent link to this article: http://www.sfdcpoint.com/salesforce/lookup-screen-component-in-salesforce-lightning-flow/

1 comment

    • Patryk on December 31, 2019 at 5:33 pm
    • Reply

    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.

Leave a Reply

Your email address will not be published.