#1MinuteTip In Salesforce, when you click on a lookup field, there are two values that are displayed. The “Name” field of the lookup object and a second field. So, how do you change the 2nd value displayed in lookup field?
For example, when you create a case and click on the field to add the contact, it will display the Contact Name & Account name like the image below.
The information displayed as the 2nd value comes from 2nd column defined in the Search Layouts -> Default Layout on the object as shown below.
To display a different value, change the 2nd field in the Default Layout. Liked I have changed it to Phone.
And now, phone will be displayed as the 2nd value in the lookup field for Contact.
To display multiple values, you can create a formula field and set that as the 2nd column in Search Layouts -> Default Layout. I created a formula field of text type to concatenate Email & Phone on the Contact object and added that field as 2nd column in Search Layouts -> Default Layout. And now the lookup field shows the value as shown below.
IMPORTANT: Do note that not all the field types can be displayed as the 2nd value in the lookup field. For example, if you set the field type “Email” as 2nd column in search layout, it won’t be displayed in the lookup field. In that case, 3rd column from the search layout will be displayed. Do take a look at the Salesforce help article below to see those exceptions.
References & Useful URLs
- Salesforce Help Article – Secondary Fields are Displayed for Instant Results on Search for Recently Viewed Records
hello,
can I change the 1st field instead of the record number that is auto-generated to a different text field in a custom object?
Hi Salah, I tried doing that and got the error – “Error: Name must be the first field in the search layout.” I don’t think it is allowed.
i got stuck trying to add a checkbox as the secondary field. There are limits to the supported field types that can show as the secondary field so I created a formula: https://help.salesforce.com/s/articleView?id=sf.search_lookup_faq_secondary_field_lex.htm&type=5
Thanks for sharing, Rachel. Formula seems to be the way to go if you can’t display the original field. 🙂