Add "To Address" through email script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2022 11:13 PM
Hello,
We have one global notification that will trigger to "requester" when any RITM is created on any catalog item. Here my requirment is, for one "XXX" catalog item if requester select one drop down variable as "ABC", we need to send out an email to one DL along with the requester.
I have created one email script & added in the global notification. But it is not showing in "To" address. However it is showing in CC or BCC
if (current.cat_item == 'a0b234d9dbf0941027fd10284b961920') {
var gr = new GlideRecord("sc_req_item");
gr.addQuery('sys_id', current.sys_id);
gr.query();
if (gr.next()) {
if (gr.variables.request_type == 'create' && gr.variables.data_object == 'GL Master') {
email.addAddress('To', 'XXX@gmail.com');
//email.addAddress('CC', 'XXX@gmail.com');
//email.addAddress('BCC', 'XXX@gmail.com');
}
}
How can we add in "TO" Adreess through email script.Please help here.
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2022 11:18 PM
Hi,
you can only include CC and BCC via email script.
Recipients can be sent dynamically if you are triggering the email via event i.e. using gs.eventQueue('event_name', glideRecordObject, recipients);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2022 11:21 PM
Hi ankur,
Tq for you reply. On my requirement, How can i achieve through event as it was a global notification & it was send when record is inserted on RITM table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2022 11:27 PM
Hi,
then you will have to make it event based.
Do this
1) create new event and new notification linked to this event
2) trigger this new email via after insert on RITM using gs.eventQueue() syntax
3) update OOB Notification not to trigger for your catalog item so that OOB doesn't trigger for your RITM
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2022 09:34 PM
@n
Hope you are doing good.
Did my reply answer your question?
If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader