Add a static attachment to an email that is sent upon creation of a case.

bigbacon
Giga Guru

I know this question has been asked here: 

Solved: Using Flow Designer, add attachment to Send Email ... - ServiceNow Community

 

but I'm wondering if there is an easier more out of the box solution to have an attachment thats always added to a canned email notification that is sent when a case is created. 

it wouldn't be a dynamic attachment, so nothing that was added to the case by the user. 

18 REPLIES 18

Ankur Bawiskar
Tera Patron
Tera Patron

@bigbacon 

do this

1) create a system property of type string with any value

2) add that static attachment to this sys property record

3) use after insert BR on sys_email and add file on the fly to the outgoing email

I shared solution for something similar 2 years ago

Adding latest attachment from sys_attachment table to sys_email record 

You change the table as sn_customerservice_case

AnkurBawiskar_0-1738243247830.png

 

 

 

BR script

(function executeRule(current, previous /*null when async*/) {

        var propertyRecordSysId = ''; // give here the sysId of newly created system property record where file is present
	var s_Attach = new GlideRecord('sys_attachment');
	s_Attach.addEncodedQuery('table_sys_id=' + propertyRecordSysId);
	s_Attach.query();
	if(s_Attach.next()){
		var rec = new GlideRecord('sys_email_attachment');
		rec.initialize();
		rec.attachment = s_Attach.sys_id;
		rec.file_name = s_Attach.file_name;
		rec.source = 'notification';
		rec.content_disposition = 'attachment';
		rec.email = current.sys_id;
		rec.insert();
	}
})(current, previous);

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

can you provide a larger screenshot? the one attached is very small and blurry.

So if I am reading this right, we some how add our attachment to the sys_attachment table and then we can add the attachment to the notification using this business rule? 

Can you explain Step #2 a bit more? I guess I'm confused on where/how to store the static attachment in order to complete this.

@bigbacon 

yes some placeholder is required to hold that file.

1) create system property and add that file there

2) after business rule on sys_email with your condition

Hope this image is fine for you

AnkurBawiskar_0-1738503797234.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader