BCC email notification from parm1

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2024 05:43 PM
I am wanting to send a notification out to a changing list of recipients, I already have that handled in a flow that ultimately fires an event that contains the recipient list, however it is adding those from parm1 into the 'To' field of the notification and I'd like it to not add anyone to the 'To' field and instead add them to the 'BCC'
I know that if I have a set list I can add the users via a mail script, however I'm not aware of how to handle it when I want to use parm1 instead of a particular user.
Anyone able to assist please?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2024 12:25 AM
@Vaishnavi Lathk do you mean mail script?
Or does this script go in the actual notification somewhere?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2024 06:29 PM
So thanks to @Gangadhar Ravi I have the following mail script, that sort of works, but there are issues still:
Script name is:
BCC.parm1.script
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
// Add your code here
// Get the recipients list from parm1
var recipients = event.parm1;
if (recipients) {
// Convert parm1 to an array (in case it's comma-separated)
var recipientArray = recipients.split(',');
// Add each recipient to the BCC list
for (var i = 0; i < recipientArray.length; i++) {
email.addAddress("bcc", recipientArray[i].trim());
}
}
})(current, template, email, email_action, event);
In the notification body I have called the mail script with:
${mail_script:BCC.parm1.script}
Scenario 1:
Notification "Who will receive" has Event parm1 contains recipient selected.
Result - Notification is sent twice - once to all in the To field and again to same people in the BCC field.
Scenario 2:
Notification "Who will receive" has nothing at all selected.
Result - No notification sent at all
Scenario 3:
Notification "Who will receive" has myself added as a recipient.
Result - Multiple notifications are sent, but no one shows for all but one of the in the To, CC or BCC fields and an error is available:
"System address filter excluded email addresses (Missing final '@domain'): c23a5620c942e550bdae5d1ef478d5e8, 1c57fdb8900c7590662da657ee3b1d68, etc"
Looks like it is not getting emails from the user sys_id's
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2025 12:39 AM
Hello,
You can add in your event a blank email,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2025 06:14 PM
@MakeYourLife thank you for the reply however I don't really understand what I need to with those instructions, would you be able to be a little more specific?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2025 10:44 PM
Hello @Moedeb ,
I had the same issue than your scenario1, Here is what I did, I hope it helps :
- I have a business rule that triggers whenever a record is created, I retrieve a list of users and get the emails, when I call the event to trigger the notification I added in the event parameter 1
example:
gs.eventQueue('event.name', GlideRecord, parm1, parm2); // standard form
gs.eventQueue('x_58872_needit.overdueNeedItTask',current,"email@noreply.com", bccString);
=> In bccString you have the dynamic emails
Then in my email notification I check the event_parm_1
This should avoid sending to "To" recipients, and only in bcc but it seems we must have a recipient in "To" that is why I setted it as a blank "noreply" email