Useful attachment scripts
-
- UpdatedAug 1, 2024
- 2 minutes to read
- Xanadu
- Notifications
This is a searchable version of the Useful Attachment Scripts.
Warning: The customization described here was
developed for use in specific instances, and is not supported by Now Support. This method is provided as-is
and should be tested thoroughly before implementation. Post all questions and
comments regarding this customization to our community forum.
Copy attachments from record to record
Use the following script to copy an attachment from one record to another
record:
Note: GlideSysAttachment.copy
copies all attachments; it cannot select specific attachments.
Delete duplicate attachments
Use the following script in a business rule, scheduled job, or background script to delete
duplicate attachments located in the Attachments [sys_attachment]
table:
Display whether tasks have attachments in list view
Use the following script in a business rule to display whether tasks have attachments when
viewed in the record list view. Note that the script needs a custom field on the Has
Attachments [u_has_attachments] table.
Note: Schedule the business rule to run after insert/delete.
Link to attachments in an email notification
Use the following script in an email notification or template to include links to
attachments:
Note: Replace "instance_name" with your instance name.
Attachment Logging
Whenever a user downloads an attachment, the action writes an
attachment.read event record to the event log. If desired, you can
process these events with a Script Action or an Email Notification. This can be useful if
you want to do something when an attachment is read. For example, you can record when and by
whom certain attachments are downloaded. For this functionality, the
current variable must point to a sys_attachment record, and the event
record must use the following parameters:
- parm1: File name
- parm2: Table name
On this page
Related Content
- JavaScript in emails
Create mail scripts in System Notifications Email Notification Email Script , and refer to them by using ${mail_script:script name} in the script field.
- Mail script variables
Certain variables are available when processing mail_script scripts.
- Example scripting for email notifications
Examples of scripting for email notifications.