function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
birthusbirthus 

Salesforce Search lookup

I have some problem with search in salesforce.
One of our custom objects has lookup to user, when Im trying search for this object by user name - I dont get this object.
So question is : is it possible to search all object field based on value in lookup field/user name in standard salesforce search (not in the code)?

ericmonteericmonte

Is this custom object have a tab related to it? So with SFDC, if you dont have the custom object in a tab you will not be able to do a search on that object.

birthusbirthus
It has tab.
GunishGunish
Hi,

The challenge here is that although Lookup fields are displayed as Record Names, But internally they are stored as Record ID's, which is why the search results do not return these values in search.

Here are two approaches and one of them will work for sure
Approach A :
1. Create a formula field of type Text on the object to copy the value from the Lookup field into the itself.
2. Don't add this field on the page layout.

Approach B:

If Approach A Does not work
1. Create a second hidden text field on the object,
2. Create a workflow rule to copy the value from the lookup field to the hidden text field, every time a record is edited or created.

Give this a try and let us know if this helped!

Regards,
Gunish