Administering attachments
Summarize
Summary of Administering attachments
ServiceNow administrators can configure how file attachments are managed within the platform, including uploading, viewing, deleting, and indexing files attached to records. Attachments trigger specific system events usable for notifications or scripting. Configuration options help control attachment behavior, display, and security to optimize performance and user experience.
Show less
Attachment Storage and Management
- Attachments metadata is stored in the sysattachment table, while actual file data is stored in chunks within the sysattachmentdoc table.
- Uploading, viewing, and deleting attachments each trigger a single event per record, regardless of the number of attachments involved.
Activity Stream Image Handling
- The glide.ui.activitystream.scaleimages property (enabled by default) scales large images and creates thumbnails for activity stream views, with maximum thumbnail dimensions of 525x350 pixels.
- Images over 5 MB can cause out-of-memory errors when thumbnails are generated, potentially restarting the instance.
- Administrators can set the com.glide.attachment.maxgetsize system property to define the maximum size (in bytes) for image scaling, defaulting to 5 MB. Images larger than this size will not be scaled but linked instead.
Attachment Events and Logging
- Key attachment events include: attachment.read (file downloaded), attachment.uploaded, attachment.deleted, and attachment.renamed.
- Only one event is generated per record action even if multiple attachments exist, except when deleting a record with multiple attachments, which creates individual events per attachment.
- Attachment read events can be logged with parameters such as filename and table name, enabling tracking of who downloaded attachments and when.
Debugging and Indexing Attachments
- Administrators can enable debug logging for attachment indexing using the glide.ts.index.attachment.debug and glide.ts.index.attachment.listterms.debug system properties.
- These properties help capture exceptions and indexed terms but should be disabled during normal operations to maintain optimal performance.
- Attachment indexing can be enabled on tables to include file content in text search results.
Configurable Attachment System Properties
- Disable drag-and-drop attachment uploads while still allowing file browsing uploads.
- Set limits on attachment file size and restrict who can upload files and which file extensions are allowed.
- Prevent attachments on specific tables.
- Hide the [view] link next to attachments to disable opening files via browser JavaScript, while retaining access through the filename link.
- Customize attachment icons based on file types for better visual identification.
Practical Benefits for ServiceNow Customers
These capabilities enable administrators to maintain control over attachment management, improve system stability by preventing resource-intensive operations, and enhance security by limiting attachment types and upload permissions. Event-driven notifications and logging provide auditability and automation opportunities, while indexing attachments improves search effectiveness across records.
Administrators can configure system properties for how files are uploaded and attached to records. Uploading, viewing, and deleting file attachments triggers a single event that can be used for notifications or in scripts.
Attachment tables
When you store an attachment to any table, a record is created in the Attachment [sys_attachment] table that contains attachment metadata. The file data is stored in the Attachment Document [sys_attachment_doc] table, in 4k chunks. For example, if you attach a 12k file called My_attachment.pdf, then there is an Attachment entry with three related Attachment Document entries.
To learn how to upload attachments to records, see Add and manage attachments.
Activity stream thumbnail scaling
- Maximum dimensions for thumbnails using this property are 525 pixels width by 350 pixels height. The system favors the pixel height first, so you can end up with images that are wider than 525 pixels.
- Attaching image files over 5 MB can create an out of memory error and cause the instance to restart. An out of memory error and restart occur when the system generates the thumbnail when you attach a new image. The error and restart can also occur the first time you load existing images on a record.
- The administrator can add the com.glide.attachment.max_get_size system property to control the maximum image scaling dimensions.
| Field | Description |
|---|---|
| Name | com.glide.attachment.max_get_size |
| Type | integer |
| Value | 5242880 |
- The base system value is 5242880 bytes (5 MB). You can change the value as necessary.
- With this property set, images that are larger than 5 MB are not scaled and the system creates a link instead. Images smaller than 5 MB are scaled down.
Configure the max image size property for Activity Streams
When attaching an image in an Activity Stream, the system controls the maximum size of the image. Use the com.glide.attachment.max_get_size property to control the maximum image scaling dimensions.
Attachment events and logging
A script action or notification can process attachment events. Only one event is created when action is taken on a record with attachments, even when the record has multiple attachments. The following events are provided.
Only one event is created when action is taken on a record with attachments, even when the record has multiple attachments. The following events are provided.
| Event | Description |
|---|---|
| attachment.read | An attachment has been read or downloaded. |
| attachment.uploaded | An attachment has been uploaded. If multiple attachments are uploaded to a record at one time, only one event is created. |
| attachment.deleted | An attachment has been deleted. This event is also triggered when the record containing the attachment is deleted. If a record is deleted that contains multiple attachments, a separate event is triggered for each attachment in the deleted record. |
| attachment.renamed | An attachment has been renamed. |
Attachment logging
- parm1: File name
- parm2: Table name
Debug attachment indexing
To change debugging options for attachment indexing, add these system properties.
- glide.ts.index.attachment.debug: When the value is set to
true, enables log messages for exceptions that occur when
indexing attachments (default is false).
You can leave this property enabled during normal operations to capture stack trace information about any exceptions.
- glide.ts.index.attachment.list_terms.debug: When the value is set
to true, logs all indexed terms when an attachment is indexed
(default is false).
[Recommended] For optimal performance, set this property to false during normal operations. Only enable this property when you are actively debugging an issue.