Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

How to include a static attachment to a notification

mynedisanjana
Tera Contributor

Hi ,

 

I have a requirement where i need to send an email including a static attachment as a pdf. how can we achieve this.

 

Regards,

Sanjana. 

5 REPLIES 5

Dr Atul G- LNG
Tera Patron

Hi @mynedisanjana 

 

Do you want to send attachments which are added on record?  If yes

 

Use this option:

LearnNGrowAtul_0-1705921785689.png

 

Or you want a new attachment with the email ?

 

https://www.servicenow.com/community/developer-forum/add-attachment-to-notification-email/m-p/143458...

 

https://www.servicenow.com/community/developer-forum/how-to-add-an-attachment-to-an-email-vial-scrip...

 

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

This is giving me a link in the notification but i want it as a document attached to the email

Hi @mynedisanjana 

 

Could you please check the links provide as above or @Sandeep Rajput provided with screenshot.

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

Sandeep Rajput
Tera Patron

@mynedisanjana We had the similar requirement where we were supposed to copy a static pdf on an outbound email associated with a specific notification. 

 

1. As a first step, we attached the static file to the Notification (sysevent_email_action) record which is being used for sending the outbound email

2. In second step, we created a business rule on sys_email table as follows.

 

Screenshot 2024-01-22 at 4.48.50 PM.png

Here we only trigger this BR if the type changes to send ready and body contains sysparm_notification= <sys_id of the notification>

 

Screenshot 2024-01-22 at 4.50.11 PM.png

In the script, we are simply copying the attachment from the notification record to the email record. 

Hope this helps.