If you’ve ever used the List All Attachments activity in ServiceNow and found yourself staring at an overwhelming number of results, you’re not alone. This behavior often catches users off guard, but it’s actually by design. Let’s dive into why this happens and how to use the Where clause for more precise results.
How the ServiceNow Attachments Table Works
In ServiceNow, the attachments table (sys_attachment) serves as a central repository for all file attachments across the platform. This includes attachments from various tables such as:
- Incidents
- Tasks
- Requisition items
- Catalog items
- And so on
Since the attachments table aggregates data for all these tables, querying it without providing specific criteria will naturally return every attachment in the system. While this design is efficient for centralized data management, it can be overwhelming if you’re only looking for a specific attachment.
Why specifying the Table name and Table sys id Matters
To narrow down results, you must include the table name and table sys id of the record you’re interested in. Here’s why:
The table name tells ServiceNow which table the attachment belongs to (e.g., Incident, Task).
The Table sys id identifies the specific record in that table to which the attachment is linked.
Without these details, ServiceNow will assume you want to retrieve all attachments across all tables, leading to a massive dataset in your results.
So, if you wanted to retrieve incident attachment, use Table name = incident and Table sys id = ServiceNow Incident ID.
Here is a small recording of how I did it.
Happy learning!!