Pass a catalog variable type is reference(Users) into the To/CC field of an email notification
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2024 03:35 AM
I am looking to pass a catalog fvariable type is reference(Users) into the To/CC field of an email notification. Can anyone please HELP me with this!?
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2024 04:33 AM
Hi @Yamini Consulta ,
You can make use of Notification email script here and use the code below:
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
// Add your code here
var getDetails = current.variables.YOUR_REFERENCE_VARIABLE_NAME_HERE;
var usr = new GlideRecord('sys_user');
usr.addQuery('sys_id', getDetails);
usr.query();
if (usr.next()) {
email.addAddress('cc', usr.email.toString(), usr.name.toString());
}
})(current, template, email, email_action, event);
Note: Please make sure to check the correct table name on which your notification is on. I am assuming you are talking about Requested Item table.
Now call this notification email script in your notification as below which should send out the email to CC or BCC Users.
${mail_script:Your MAIL Script Name Created Above}
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke