Attachment
Summarize
Summary of Attachment Variable
The Attachment variable allows users to upload attachments as part of catalog item requests in ServiceNow. It supports managing attachments by enabling download, update, and deletion actions both during request submission and fulfillment (requested item or catalog task).
Show less
Key Features
- File Restrictions: You can restrict file size and allowed file extensions using the
maxfilesizeandallowedextensionsvariable attributes. - Size Limits: The maximum file size defaults to the
glide.sc.variable.attachment.defaultmaxsizesystem property (default 20 MB) unless overridden bymaxfilesize. However, the globalcom.glide.attachment.maxsizeproperty caps all attachment sizes across the ServiceNow AI Platform. - Attachment Lifecycle: Attachments are saved to the
sysattachmenttable when the item request is submitted, added to cart, or saved in fulfillment flows. Editing an attachment replaces the old file, and deleting or updating before submission clears the attachment entry. - Attachment Copying: Attachments are copied in scenarios such as:
- Order guides cascading variables to catalog items (note that individual variable attributes are not honored initially in the rule base).
- Record producers mapping the variable to a task table field of File Attachment type.
- API Support: The
gform.setValue()client script API is supported for this variable. - Security: If system-wide anti-virus scanning is enabled, attachments are scanned when submitting requests or adding items to cart or wish list.
- Compatibility: This variable is supported in flows, workflows, and condition builder but not in multi-row variable sets or order guide item variable assignment.
Key Outcomes
- Enable requesters to attach relevant files directly to catalog items, improving information completeness for service fulfillment.
- Control attachment size and file types to maintain system performance and security compliance.
- Maintain attachment integrity and independent management when attachments are cascaded or copied across order guides, catalog items, and record producers.
- Leverage the variable in various ServiceNow automation tools and interfaces while understanding its limitations in multi-row variable sets and order guide assignments.
When submitting a catalog item request, this variable lets you upload an attachment for a question of the item.
- You should specify only an integer value for the following:
- The max_file_size variable attribute
- The glide.sc.variable.attachment.default_max_size system property (catalog-level). The default value is 20.
- If the max_file_size variable attribute is not specified, the glide.sc.variable.attachment.default_max_size system property value is considered as the upper limit for the attachment file size.
- Irrespective of the file size allowed in the variable, the attachment file size cannot exceed the size specified in com.glide.attachment.max_size system property, which is applicable for attachments across ServiceNow AI Platform.
- The g_form.setValue() API is supported in catalog client scripts.
When you upload an attachment to this variable, an entry is created in the Attachment [sys_attachment] table. The variable is not updated until you submit the item request, add it to the cart, or save the record while editing it (in fulfiller flows). If you delete or update the attachment before submitting the corresponding catalog item, the entry in the Attachment [sys_attachment] table is cleared.
- In an order guide, when the variable is cascaded to a catalog item in the rule baseImportant:The individual variable attributes are not honored for the catalog items in the rule base. For example, let us consider that a variable in the Describe Needs section allows a .pdf attachment and the variable of a catalog item in the rule base allows a .txt attachment. When you upload an attachment of .pdf type for a variable in the Describe Needs section, it is initially cascaded to the variable in the catalog item as well and the variable attributes specified in the catalog item are not honored. However, if you delete this initially cascaded attachment from an individual item and try to upload a new attachment, then the individual variable attributes of the catalog item are honored.
- In a record producer, when the variable is mapped to a task table field. This variable can be mapped only to the File Attachment field type of a task table.
- Submit a request for the corresponding catalog item
- Add the catalog item to the cart or wish list
- This variable is not supported in a multi-row variable set.
- This variable is supported in flows and workflows.
- This variable is available in condition builder
- For this variable, item variable assignment is not supported in order guide.