Visual Workflow allows us to automate business processes by building applications, known as Flows. Using Flows, a user can collect information; or, they can update, edit, or create records in Salesforce. Furthermore, Flows can execute logic, interact with the Salesforce database, call Apex classes, Platform Events, and guide users through various screens to streamline the process of collecting and updating data. Once a Flow is built, an Admin can make the Flow available to the right users or systems.
Visual Workflow is similar to the Visualforce page for admin – for, by using Visual Workflow, an Admin one can create a powerful wizard for data entry or display a message without writing a single line of code!
There may be times when an Admin wishes that s/he could add a Lookup field to Flow Screen Element. But, as we all know, unfortunately, Visual Workflow doesn’t support Lookup field. As a result, whenever an Admin needs to use a Lookup field, s/he has to use Dynamic Record Choice.
For example, suppose you want to use lookup functionality to display Chatter Group – based on matching result – to users based on their input. If so then, you can do so using the following Elements:
- Two Screen elements
- One Textbox field
- One Dropdown List field
- One Variable
- Dynamic Record Choice
Check out this video for detailed instructions:
Screenshot for your reference (transcript of video):
Ya, I know! Looks, and is, pretty complex to build a Lookup kind of field in Visual Workflow.
You may be wondering – can I achieve the aforementioned solution using just one field with a better outcome?
Well, you are in luck! Thanks to Salesforce.com Inc, Process Automation team Arna Bose, Jason Teller, and several other members, for maintaining this site.
Business Use Case
Edward Backhouse is working as System administrator at GurukulOnCloud. He received a requirement to add a Lookup field on Flow Screen element which should instantaneously display Lead based on user input.
The solution for the above business requirement
There are few possible solutions for the above business scenario. One of them, of course, is to continue to use the old method, as shown in the preceding screenshot.
But, Edward is a Salesforce Ninja like us! And, therefore, he is always on a lookout for creative options. As a result, Edward found that a lookup Lightning Component offered by the Flow team! So, instead of using the old method, he took the following steps:
- Edwards installed a Lightning Component offered by Flow team.
- He navigated to Setup (Gear Icon) | Setup | Process Automation | Flows in Lightning Experience.
- Next, he used Screen element to display Lookup field. Edward clicked on the Palette tab and dragged and dropped the Screen element onto the canvas. This opens a new window.
- On the Screen element, Edward navigated to the Add a Field tab and double-clicked on the Lightning Component field to add it on to the Screen element – as shown in the following screenshot:
- On the Screen overlays preview pane, Edward clicked on the [Lightning Component] field to configure its settings, as shown in the following screenshot:
- For the Lightning Component drop-down on the Field Settings tab, he selected flowcomponents:lookupFSC.
- Edward knows that he can pass values between the flow and the component by using the Inputs and Outputs tabs. As a result, in the end, Edward’s Flow component looked like the following screenshot:
- The attributes Edward used in the above components are as follows:
- I1_Object Name – Enter the object API name
- I2_Display Which Field? – Enter the field API Name that will show up in the list box to represent a record.
- I3_Field Label – Enter a label that appears next to the lookup control
- I4_Output Which Field as Value? – This is the field you actually want to save into the Output Value attribute. It defaults to Id – so you can have an Id to use for lookups – but, you may want to change it to Name or some other value. Checkout this documentation for the complete reference of attributes.
- In the end, Edward’s Flow will look like the following screenshot:
- Edwards, Saved the Flow (Type: – Screen Flow) with name Upload File – Test and close the canvas.
- Follow Edward’s footsteps – don’t forget to activate the Flow by clicking on the Activate button!
It’s time to test this feature
Now users can use the Lookup field instead of any other workaround.
If you have any problem with watching the video then, please click on it and open it in another tab. I hope you can learn from the blog about how to use Lookup field into Flow Screen element!! Yes, go ahead! Show off your newly acquired skills to your friends, colleagues, and families!
Please feel free to add constructive comments, insights – and yes, challenges too! – to the blog. Good Luck in your Journey towards becoming a Salesforce Ninja!
Technical Editor and Proofreader: - Munira Majmundar