Add physical attachments in the notification

MARISA INACIO1
Tera Contributor

Hello everyone,


I have a notification where an email goes out to the customer with 3 attachments. I have the pinch to true of "include attachments", however I can only add attachments if it is by link. That is, I add it to the notification and then add a link in the body of the email.

 

MARISAINACIO1_0-1690876634366.pngMARISAINACIO1_1-1690876798581.png


The problem is that every month I need to change the attachment and the previous one as it is by link, if I delete it from the table, the previous customers can not download the attachment.
So what I wanted was that it appeared like this in attachment (a copy) and not by link

MARISAINACIO1_2-1690876952407.png

 

Is it possible?

 

Thanks in advance

Marisa

1 REPLY 1

Kalyani Jangam1
Mega Sage
Mega Sage

Hi @MARISA INACIO1 

 

By Using email script it is possible. In email script it directly call attachment and no need to add manually.

Please use below code

Notification email script code

function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
 
var gr = new GlideRecord("sys_attachment");
gr.addQuery("table_name", "u_device");
gr.addQuery("table_sys_id", current.sys_id);
gr.query();
while(gr.next()) {
template.print ( '<a href="/sys_attachment.do?sys_id=' + gr. sys_id + '">' + gr. file_name + '</a>\n ' ) ;
}
 
In Notification You can uncheck "Include Attachment" button and call email script like below

Attachment:
${mail_script:AttachmentInclude} // Email script name

Please try and Mark Helpful and Correct if it really helps you.