- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2025 11:33 PM
Hi all, Is it possible to search the content in attachment. For example If I attach some txt file in incidnet form that particulat attachement will create record in attachment table. So If i search some keywords in that attachment in attachment table will it return that attachment record. Any help ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2025 11:48 PM
First of all you can only get content of attachment for simple file types such as csv, txt, json etc
You cannot print normal content from other file types such as PDF, PPT, WORD etc
So that's not possible.
here is sample script to print content of txt or csv or json file
Scoped app
Global scope
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2025 11:44 PM
hi @Sharath807 ,
By default, ServiceNow does not allow you to search inside the actual content of attachments like .txt, .pdf, or .doc files. When you attach a file to a record, ServiceNow creates a reference in the sys_attachment table, but the text inside those files isn’t indexed or searchable. This means that if you search for a keyword that only exists inside the attached file, the search won’t return the related attachment or the parent record — it only looks at the fields stored on the form itself, like short description or comments.
To make attachment content searchable, you typically need to enable AI Search with attachment indexing. This feature lets ServiceNow’s search engine scan inside common document types and include them in search results, but it usually requires extra configuration and a subscription. Alternatively, some teams build custom solutions that read the text content of attachments using the Attachment API and copy it into a field on the parent record, so that normal searches will find it.
If you need help deciding between these options or want to see an example of how to extract and store attachment text, let me know — I’d be happy to help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2025 12:02 AM
@Community Alums Hi thanks for reply. Yes please can you help to extract content in attachment and store in parent or custom table and use normal search to find attachment using keywords.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2025 11:48 PM
First of all you can only get content of attachment for simple file types such as csv, txt, json etc
You cannot print normal content from other file types such as PDF, PPT, WORD etc
So that's not possible.
here is sample script to print content of txt or csv or json file
Scoped app
Global scope
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader