Loading

Searching for a Salesforce Record's Name Does Not Return All Related Records

Date de publication: Jun 25, 2025
Description

Users may expect that a Global Search for an Account Name to also return ‌related records such as Contacts or Cases, but results only include the matching Account record and some or no records related to the Account.

For Example:

Let us consider we have an Account record called Acme. This Account record has 3 Contacts associated to it, namely Kevin, Jack & Viz. When a User searches for the term Acme, they observe that none of the 3 Contact records are returned despite the term Acme being present on all 3 contact records.

Résolution

This is working as designed since encrypted, formula and lookup fields aren’t searchable. You can find more documentation around Searchable fields in Classic Searchable Objects and Fields or review searchable fields in Lightning using Customize Search with Search Manager.

End users may find that some Contacts do appear in Global Search however, Global Search is finding those records because the Account Name is included in a different, searchable field. For example, if Contact record had the description field with the text, Acme, Global Search would return the Contact record.

You can work around this by creating a custom text field on the object for which you want to see related records and populate it with the related record's name or other search term via a Flow.

For example, populate a Contact's related Account Name so searching for the Account name also returns it's related Contacts.

Step 1: Create a Custom Field

1a. In Salesforce Classic: Create a custom field of data type Text by going to Setup | Customize | Contacts | Fields | New
1b. In Lightning Experience: Create a custom field of data type Text by going to Setup | Object Manager | Contact | Fields and Relationships | New
2. Choose an appropriate Field Label, Length and Description (optional) > Next.
3. Check the Visible check box twice (this would make the field hidden) > Next.
4. Uncheck Add Field. Add to page layouts. > Save.


Step 2: Create a Flow

1. Go to Setup | Flows | New Flow.

Choose Record-Triggered Flow.

 

2. Configure the Flow Trigger

    Object: Contact (or the related object that you want to return in search results).

    Trigger When: A record is created or updated.

    Conditions:

        AccountId Is Null = False (Contact must be related to an Account).

    Optimize For:

        Fast Field Updates (if possible — better performance).

 

3. Set the Field Mapping for the Contact's custom field to be populated with its related Account's Name.

You do NOT need a Get Records because Contact has a direct relationship to Account via AccountId, and Account.Name is accessible natively.

    Add an Assignment or directly in Update Triggering Record:

        Set: YourCustomTextFieldsDeveloperName__c = {!$Record.Account.Name}

 

4. Save and Activate the Flow

    Flow Name: e.g., Populate Account Name on Contacts.

    Save it.

    Click Activate.


Now simply go to a Contact record that wasn't part of your search result and Edit > Save [No need to make any changes on the record. This step is done to fire the WF action & reindex the record]

Note that the Contact record now comes up in the search result.

Numéro d’article de la base de connaissances

000385727

 
Chargement
Salesforce Help | Article