GlideSysAttachment - Scoped

The GlideSysAttachment API provides a way to handle attachments.

Content is returned as a string, not as a byte array. This may cause issues with some attachment types.

Scoped GlideSysAttachment - copy(String sourceTable, String sourceID, String targetTable, String targetID)

Copies attachments from the source record to the target record.

Table 1. Parameters
Name Type Description
sourceTable String Name of the table with the attachments to be copied.
sourceID String The source table's sysID.
targetTable String Name of the table to have the attachments added.
targetID String The target table's sysID.
Table 2. Returns
Type Description
String Array of sysIDs of the attachments that were copied.

Scoped GlideSysAttachment - deleteAttachment(String attachmentID)

Deletes the specified attachment.

Table 3. Parameters
Name Type Description
attachmentID String The attachment's sysID.
Table 4. Returns
Type Description
void

Scoped GlideSysAttachment - getContent(GlideRecord sysAttachment)

Returns the attachment content as a string.

Table 5. Parameters
Name Type Description
sysAttachment GlideRecord The attachment record.
Table 6. Returns
Type Description
String The attachment contents as a string. Returns up to 5 MB of data.

Scoped GlideSysAttachment - getContentBase64( GlideRecord sysAttachment)

Returns the attachment content as a string with base64 encoding.

Table 7. Parameters
Name Type Description
sysAttachment GlideRecord The attachment record.
Table 8. Returns
Type Description
String The attachment contents as a string with base64 encoding. Returns up to 5 MB of data.

Scoped GlideSysAttachment - GlideSysAttachment()

Creates an instance of the GlideSysAttachment class.

Table 9. Parameters
Name Type Description
None

Scoped GlideSysAttachment - write(GlideRecord record, String fileName, String contentType, String content)

Inserts an attachment for the specified record.

Table 10. Parameters
Name Type Description
table GlideRecord The record to which the attachment is to be attached.
fileName String The attachment's file name.
contentType String The attachment's content type.
content String The attachment content.
Table 11. Returns
Type Description
String The attachment's sysID. Returns null if the attachment was not added.