Global Search: Name and Attachment

Aaviii
Tera Contributor

I have a requirement to search records in global search by name, short description or attachment title for custom table. OOB am able to search incidents by name and short description. 

2 REPLIES 2

Martin Friedel
Mega Sage

Hello,

 

check this article to configure Global Search for a custom table:

Search settings filter and group global search results by table 

 

If my answer helped you, please accept it as correct and mark helpful, thank you 👍
Martin

Murtaza Saify
Tera Contributor

1. Enable Global Search for the Custom Table

  • Navigate to System Definition > Tables and open your custom table.

  • Ensure the Allow Global Search checkbox is checked.


2. Modify the Search Source Configuration

ServiceNow uses Elasticsearch for global search. You need to configure the search source for your custom table to include sys_attachment (file names/titles).

Steps:

  1. Go to Search > Search Administration > Search Sources.

  2. Open the search source associated with your custom table (e.g., [table]_source).

  3. Add sys_attachment as a related table:

    • Under Related Tables, click New.

    • Set Table to sys_attachment.

    • Configure the Join Condition:

      • table_sys_id (sys_attachment) = sys_id (custom table)

      • table_name (sys_attachment) = your custom table's name (e.g., u_custom_table).

    • Add the file_name field (attachment title) to the list of searched fields.

  4. Adjust field weights (optional) to prioritize results from name, short_description, or file_name.


3. Verify Permissions

Ensure users have read access to:

  • The custom table.

  • The sys_attachment table for records linked to the custom table.


4. Rebuild the Search Index

After configuration, rebuild the search index to apply changes:

  1. Go to Search > Search Administration > Index Management.

  2. Select your search source and click Rebuild Index.


5. Test the Global Search

Search for a term that appears in:

  • The custom table’s name or short description.

  • The title of an attachment linked to the record.