
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2023 10:28 PM
I have a notification that gets sent as part of a custom flow and is triggered when a particular event occurs - this is working perfectly.
The issue I have is, when that notification sends, I want it to include 2 particular attachments every time it sends.
I have tried the "Include attachments" checkbox in the notification, but that I believe is meant to include any attachments within the triggering record - in this case it would be a RITM, that actually has no attachments, therefore no attachments are added to the notification.
I have saved the attachments as part of a knowledge document and their sys_id's are:
Document 1 - 28a3323f11f235103b97b89ea08322d7
Document 2 - 2ca3323f11f235103b97b89ea08322d9
Knowledge articles Sys_id - f39272b3117635103b97b89ea083228b
The notification has a subject starting with - Security Requirements
So what I have tried is to create an advances business rule:
Name: Add attachment
Table: email [sys_email]
When to run =
when: before
order: 100
Insert = true (all else false)
Conditions:
Subject starts with Security Requirements
Advanced Tab:
(function executeRule(current, previous /*null when async*/) {
var sourceID = 'f39272b3117635103b97b89ea083228b';
var sourceTable = 'kb_knowledge';
var document1ID = '28a3323f11f235103b97b89ea08322d7';
var document2ID = '2ca3323f11f235103b97b89ea08322d9';
GlideSysAttachment.copy(sourceTable, sourceID, 'sys_email', document1ID);
GlideSysAttachment.copy(sourceTable, sourceID, 'sys_email', document2ID);
})(current, previous);
I also added an action to add a message when it runs.
The issue I'm having is not only does it still send the notification without attachments, I'm also not getting any message showing that the business rule is even running.
Anyone know the right way to do this?
I've looked at a few posts here and there and none of them are really helping me, so please don't reply with just a link to another article.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2023 04:38 PM - edited 12-06-2023 04:39 PM
I know you didn't want links, but this one seems to be directly addressing what you are trying to do;
https://www.servicenow.com/community/developer-articles/adding-attachments-to-email/ta-p/2320991

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2023 04:38 PM - edited 12-06-2023 04:39 PM
I know you didn't want links, but this one seems to be directly addressing what you are trying to do;
https://www.servicenow.com/community/developer-articles/adding-attachments-to-email/ta-p/2320991

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2023 07:04 PM
You are right @Kai Tingey I did specify that I didn't want links to articles, however in this case the article worked 100%, thank you very much for your help, it is certainly appreciated.