How to add CC or BCC in email notification?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2009 12:31 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2016 07:16 AM
HI Fatah,
Were is this code to be placed, in the email notification which will we are tying to send out in the email body?
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2017 12:48 PM
The code can be placed in either the email body and/or an email template for an email notification.
But, note that one needs to wrap the code within a <mail_script>.. </mail_script> block.
Here is my version which I inserted within an email template that was successful and CC's the user (sys_id) provided within parm1 of an event.
Note the template print of the date is not required, but helps demonstrate that one can use an existing block...
| <mail_script> | |
| var dateTime = new Packages.java.text.SimpleDateFormat( "MMMM dd, yyyy" ); | |
| template.print( dateTime.format( new Packages.java.util.Date()) +"\n" ); |
| // Add CC if manager (or any other user) provided within event parm1 | |
| if (!event.parm1.nil()) { | |
| //get param's and add to cc | |
| //get user records | |
| var user = new GlideRecord("sys_user"); | |
| user.addQuery("sys_id", event.parm1); | |
| user.addQuery("notification", 2); //email | |
| user.addQuery("email", "!=", ""); | |
| user.query(); | |
| if (user.next()) { | |
| //add to cc list | |
| email.addAddress("cc", user.email, user.getDisplayValue()); | |
| } | |
| } | |
| </mail_script> |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2017 11:54 AM
Hello,
Does anyone know if SNOW plans to make this functionality (specifying cc and bcc recipients) available in the UI?
Thanks,
Mike
