- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2023 01:24 AM
Hi All,
I have a requirement to send the Notification to ITIL Group manager , if user is added to the Group which has ITIL+other role .
this Notification created on the sc_req_item table based on condition.
here "select group" has 2 roles (itil + other rol'e) ,if user added to any one of the group he will get "itil" access will hence that time notification has to trigger to "ITIL Role group Manager" ,so i am not able select the ITIL Role group manager email from the "Who will receive" tab, so can that be achieved using the Email script to get the "ITIL Role group managers email" so that i can add to body of the Notification.
Please suggest how to achieve this
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2023 01:49 AM
Hi here is the example to do that, in you email script you need to get the group name , if you have a variable where group name is stored, you can get group sysid using variable value,
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var getManagerEmail = '';
//var managerEmail = current.variables.variablename; // use this line if you have group name stored in variable
var grp = new GlideRecord('sys_user_group');
grp.addQuery('sys_id','c6c828c453751300ba3dddeeff7b1219');
grp.query();
if(grp.next())
{
getManagerEmail = grp.manager.email;
gs.info(getManagerEmail );
email.addAddress("bcc",getManagerEmail);
}
})(current, template, email, email_action, event);
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2023 01:49 AM
Hi here is the example to do that, in you email script you need to get the group name , if you have a variable where group name is stored, you can get group sysid using variable value,
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var getManagerEmail = '';
//var managerEmail = current.variables.variablename; // use this line if you have group name stored in variable
var grp = new GlideRecord('sys_user_group');
grp.addQuery('sys_id','c6c828c453751300ba3dddeeff7b1219');
grp.query();
if(grp.next())
{
getManagerEmail = grp.manager.email;
gs.info(getManagerEmail );
email.addAddress("bcc",getManagerEmail);
}
})(current, template, email, email_action, event);
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2023 09:31 PM
Hi , thanks for your help, the same script i have used in Business rule and uses gs.eventQueue to trigger the notification and it working as expected.
gs.eventQueue('emailToITILManager', current, getManagerEmail);