Understanding the Lifecycle of Attachments in ServiceNow

An attachment is a computer file sent along with an electronic message.

Understanding the Lifecycle of Attachments in ServiceNow
Photo by Gianluca Cinnante on Unsplash

An attachment is a computer file sent along with an electronic message; attachments can be sent over email or via Web Services integrations. Two systems “talking” to each other can send attachments. We can send images, files, sounds and virtually any file type as an attachment over the internet.

The high-level lifecycle of an attachment is as follows:

  1. The user uploads a file.
  2. The file is converted to Base64 or binary.
  3. Based on a trigger in an email, this is the send button, but in a business application, the trigger can happen as soon as the attachment is uploaded.
  4. The system constructs a payload with an attachment converted to binary or bade64, and the message payload is sent to the target destination.
  5. The file is converted from Base64 to the originating file type.
  6. The file is retrieved from the target system.
  7. The receiving user views the file.

In ServiceNow, the attachment allows you to upload and query file attachments.

Some systems accept Base64. ServiceNow supports binary and multipart. Multipart is a way to upload files/data to a server as parts in bytes. Multipart/form-data is applied to a form so you can send everything in a multi-part form, including “regular” data.

In ServiceNow, attachments are stored in the attachments table sys_attachment. Although from a user point of view, attachments can be accessed from the incidents, problems or changes form, these files live in the sys_attachment table. To be clear, here, every file that is attached to a table in ServiceNow, in turn creates a record in the sys_attachment table. This table contains the metadata of the attached file.