Pretty sure you all have heard about Salesforce flows and the new Lookup Screen component in Salesforce Lightning Flow builder which lets you create automation rules in your org by collecting data and performing actions in your Salesforce org or an external system. Lightning Flow provides two types of flows: Screen flows and Autolaunched flows.
Previously a very important screen component was missing as a flow component which recently was made available by Salesforce i.e, Lookup Screen Component. As the name suggests, this new screen component lets users search for a record in a flow just like a lookup field in Salesforce.
The lookup screen component is used to easily search and define the record in the flow. Also, you can 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?
Assume a scenario 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 Docs object which has a lookup relationship with the Bid object. On the Bid page, I want the users to go through a set of Flow screens and enter some input which will then create a Doc record and show as a related list on the Bid object page once the flow is executed. For that, we need to establish the relation of the parent Bid record with the child Doc record. This can be done using the Flow Screen Component.
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 Document object, I have a field by the API name Bid__c which is a lookup to Bid.
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. In our case this will be the api name of the child object of which we want to create the records -> Document__c.
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.
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).
If you wish to learn more about flows and flow builder then enroll to the course Salesforce Lightning flow builder