Blog Layout

Enhanced Enhanced Lookups in Salesforce

Mike Arthur • Nov 30, 2015

Here's a little trick to make Enhanced Lookups even more user friendly

This applies to both Salesforce Classic and Lightning...

I had developed some new functionality for a customer and we were reviewing how it worked. One of the fields to be completed was a lookup field on a custom object. As this was new functionality, users wouldn't know what values are available in the lookup, and hence what to search for, and they asked if it could be a picklist so that they could see the possible values. As a picklist wasn't suitable in this case, I decided to look into it in more depth.

Firstly, I dug into the differences between Standard Lookups and Enhanced Lookups - you can see that here.

Finding out which fields are searchable proved tricky in itself but I eventually managed to find out which fields on a custom object are searchable here.

There is plenty of documentation on how to edit search layouts , but remember, that only affects the display, not the fields that are searched. Turns out that there is very little control over which fields are actually searchable as the above link shows.

The feature that I took advantage of to make my enhanced lookup more 'picklist' like was the fact that when 'Enhanced Lookups' are enabled for the custom object, custom text fields are searched if the user clicks the 'All Fields' radio button on the Lookup Search dialogue.

To enable Enhanced Lookups, type 'Search Settings' in the Quick Find box in Setup and click on 'Search Settings'. There you will find settings for each object.

I added a custom field to the custom object which is the subject of the lookup search and called it 'Search Me'. It is visible to all profiles but not displayed on any page layouts. I gave it a default value of 'All'.

To update all existing records I went to an 'All' list view for the custom object, included the field 'Search Me' as a column, ticked the checkbox at the top of the column on the left to select all records, double-clicked 'Search Me', chose 'update all selected' and set the value to 'All'. To do this you need to bring the 'Search Me' field on to a page layout temporarily so that it is inline editable. If the field is not on a page layout you can't edit it inline in a list view. If you have a large number of existing records you may prefer to use a data manipulation tool such as Data Loader or dataloader.io to update them all.

Now, when a user gets to the lookup search and they don't know what to search for, the pop up help text on the field tells them to enter 'All' in the search box, click 'All Fields' and click 'Go'. When they do this, hey presto, all records are returned. The number of records on each result page can be set in the 'Search Settings' mentioned above.

With Lightning, you just enter 'All' in the search box, click to search and you get an infinitely scrolling list of results.

Hopefully this makes it a little bit easier to use and hence more likely to be used.

My Blog of Salesforce Stuff

by Mike Arthur 16 Oct, 2021
'XHR Failed' error when trying to install VS Code extension
by Mike Arthur 09 Jun, 2020
What is $A (dollar A) in Lightning Aura component framework? Is it a global variable? Where are the docs for $A?
by Mike Arthur 08 May, 2020
Authorise a Salesforce Connected App using OAuth 2.0 JWT Bearer Flow
by Mike Arthur 26 Apr, 2020
REST API Connection to Salesforce Connected App Using OAuth 2.0 Authentication from Postman
by Mike Arthur 23 Mar, 2020
How to create a Lightning tab menu with dropdown sub-menu
by Mike Arthur 27 Nov, 2018
How to show a month by month trend chart with multiple years on same chart
by Mike Arthur 06 Nov, 2018
What to do if you receive emails about expiring certificates
22 Aug, 2018
Process json strings when working with integrations
by Mike Arthur 22 Aug, 2018
If you're switching email accounts you can copy appointments from one calendar to the other
by Mike Arthur 22 Aug, 2018
When you search in Outlook 2016, how do you see in which folder you filed an email in the results?
More posts
Share by: