How to add attachments while sending out an email notification?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2024 11:38 AM
Hi,
I used the below script in a business rule to add a static attachment along with one of the email notification.
(function executeRule(current, previous /*null when async*/ ) {// Add your code here
var grSysAtt = new GlideRecord('sys_attachment');
grSysAtt.get('ab1fc95cdbaf101082f21780399619ff'); //mention your attachment sys_id
var content = new GlideSysAttachment().getContentStream(grSysAtt.sys_id);
new GlideSysAttachment().writeContentStream(current, grSysAtt.getValue('file_name'), grSysAtt.getValue('content_type'), content);
})
(current, previous);
The script is working fine, but the attachment is not being sent along with the email notification.
Currently the target table in BR is sys_email, on which its not working but when I gave the table as sys_email_logs, the attachment was correctly attached to the log during testing. Please help me to find why exactly is this BR not working on sys_email table.
Regards,
Vandana M V
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2024 11:48 AM
Is this BR on the sys_email table?
Why dont you just copy the attachment to the email?
Below article can help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2024 03:18 AM
Hi Sanjiv,
Thank you for the response. I have used the same code mentioned in the community link which you mentioned as well. But on sys_email table it does not work.
Regards,
Vandana M V