Loading

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

Veröffentlichungsdatum: Jun 25, 2025
Beschreibung

Users may expect that a Global Search for an Account Name also returns related records such as Contacts or Cases associated with that Account. However, results typically include only the matching Account record and not related child records.


Example Scenario:
Consider a Salesforce org with an Account record called Acme. This Account has 3 Contact records associated with it — Kevin, Jack, and Viz. When a user searches for the term Acme in Global Search, none of the 3 Contact records appear in the results, even though the term Acme is present on all 3 Contact records via the Account lookup field.


Lösung

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.

Some Contact records may still appear in Global Search results for "Acme" if the word Acme appears in a different, searchable text field on the Contact — for example, in the Contact's Description field. Global Search finds those records because it matches against the searchable field value, not the lookup field.

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.

Workaround: Use a Custom Text Field and a Flow

The recommended workaround is to create a custom searchable text field on the related object (such as Contact) and automatically populate it with the parent record's name using a Salesforce Flow. Once the field is populated, Global Search can find the Contact record when searching for the Account Name.


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 and select Record-Triggered Flow.
  2. Configure the Flow Trigger:
    1. Object: Contact
    2. Trigger When: A record is created or updated
    3. Condition: AccountId Is Null = False (the Contact must be associated with an Account)
    4. Optimize For: Fast Field Updates (recommended for better performance)
  3. Add an Update Triggering Record element and set the mapping:
    1. Set: YourCustomTextFieldApiName__c = {!$Record.Account.Name}
    2. Note: No separate Get Records element is needed because the Contact object has a direct relationship to Account via AccountId, and Account.Name is natively accessible.
  4. Click Save, give the Flow a name (for example: "Populate Account Name on Contacts"), then click Activate.
 

After the Flow is activated, open a Contact record that did not appear in your original search and click Edit > Save (no changes required — this fires the Flow and re-indexes the record). The Contact now appears in Global Search results for the Account Name.

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

Nummer des Knowledge-Artikels

000385727

 
Laden
Salesforce Help | Article