Stop notification to particular group

Apaul
Tera Contributor

Any payroll or HR related notification should not be sent to one group. There are 100s of notifications which is not possible and mostly ootb. Any other way to exclude that group from getting any notifications?

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@Apaul 

no direct way to handle this.

1) remove that group in notifications where it's configured in Who will receive

2) for that group try removing group email

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Apaul 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

if assignment group changes to payroll tier then no notification to the member of this group if state changes, comments added, no notification Assigned to you Task created then also no email.
this is rhe scenario

Gaurav Shirsat
Mega Sage

Hello @Apaul 

 

you can try below code to exclude the group using notification email script:
Note: I haven't implemented this. I found this workaround on ServiceNow community another thread


var recipients = [];
for (var i = 0; i < current.recipients.length; i++) {
var user = current.recipients[i];
if (!isUserInExcludedGroup(user)) {
recipients.push(user);
}
}

 

function isUserInExcludedGroup(user) {
var gr = new GlideRecord("sys_user_grmember");
gr.addQuery("user", user);
gr.query();
while (gr.next()) {
if (gr.group.name == "Name of the Group to Exclude") {
return true;
}
}
return false;
}

email.setTo(recipients);

 

Thanks and Regards

Gaurav Shirsat