Select attachments in a email notifcation

Ola Gunnarsson2
Mega Contributor

I have a question about Attachments in a Email Notification.

In the configuration in a Email Notification (Advanced view) there is a checkbox where you can send all attachments on a record attached to the Notification.

But we don't want to send all attachments on a record, but only selected ones. Is there a way todo this by script or any other ways ?

On the record form we would like to have a related list with all Attachments where we can select the attachments we would like to send with the notification.

Most of all we would like to get the selected attachments physically in the notification because the receiver does not have any account in ServiceNow (its a Vendor).

I have found a solution where they used a public Knowledge base, and the selected attachments were attached to an public article and the link to the public article was written in the email notification. This is a good solution if you have a public Knowledge base. But today we do not have a public Knowledge base, so therefore we wish to find a solution where the selected physical files are attached directly into the email notification.

Do any of you know if this is possible?

Or do you know if this is a feature that will come to ServiceNow in any future Releases?

Thanks for any answer

//Ola

1 ACCEPTED SOLUTION

TrevorK
Kilo Sage

One way this would be achievable is an Email Script. You will use the GlideSysAttachment.copy function (Copy Attachments from Record to Record - ServiceNow Wiki ) to copy the attachment to the email record (so from the email table). Your logic would be to look for what attachments to include (e.g.: modify the attachment table to hold this value, create another table or field to store this, etc.). Within your email script you have the "current" object point to the entry in the Email table, so "current.sysid" is the pointer to the appropriate record on the Email table.



At the end of the day, it seems daunting but it really simple. You just copy the attachment(s) you want to the email record before it is sent, and off it goes.



(I am sure you could also do this with a Business Rule as well)



Any questions let me know!


View solution in original post

3 REPLIES 3

TrevorK
Kilo Sage

One way this would be achievable is an Email Script. You will use the GlideSysAttachment.copy function (Copy Attachments from Record to Record - ServiceNow Wiki ) to copy the attachment to the email record (so from the email table). Your logic would be to look for what attachments to include (e.g.: modify the attachment table to hold this value, create another table or field to store this, etc.). Within your email script you have the "current" object point to the entry in the Email table, so "current.sysid" is the pointer to the appropriate record on the Email table.



At the end of the day, it seems daunting but it really simple. You just copy the attachment(s) you want to the email record before it is sent, and off it goes.



(I am sure you could also do this with a Business Rule as well)



Any questions let me know!


Ola Gunnarsson2
Mega Contributor

I just found a great article about Attachments!



ServiceNow Pro Tips — Understanding Attachments in ServiceNow



Enjoy


Hi Ole,



I have the exact same request about sending selected attachments with the email notification.



Did you get it to work and how did you get it to work ?



Thanks.



/Kim