- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2025 04:16 AM
I have requirement when group manager is member of group then that user should not received notification. I have done this one through Event triggered. Event is triggering but notification is not getting sent. Could you please check below code. Business rule on the incident table for the after insert as notification on incident table.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2025 04:35 AM
Ensure these things
1) event is on incident table
2) notification is on incident table and fired when event is processed
a) Send to event creator - true
b) event parm1 contains recipient - true
something like this
var userArr = [];
var group = current.assignment_group;
var groupManager = group.manager.toString();
var grMember = new GlideRecord('sys_user_grmember');
grMember.addQuery('group', group.sys_id);
grMember.query();
while (grMember.next()) {
if (grMember.group.exclude_manager.toString() == 'true' && groupManager == grMember.getValue('user')) {
// do nothing for this user as it's manager who is member and exclude flag is true
} else {
userArr.push(grMember.user.toString());
}
}
gs.info('Manager is excluded from the notification.');
gs.eventQueue('Exclude.manager', current, userArr.toString());
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2025 04:35 AM
Ensure these things
1) event is on incident table
2) notification is on incident table and fired when event is processed
a) Send to event creator - true
b) event parm1 contains recipient - true
something like this
var userArr = [];
var group = current.assignment_group;
var groupManager = group.manager.toString();
var grMember = new GlideRecord('sys_user_grmember');
grMember.addQuery('group', group.sys_id);
grMember.query();
while (grMember.next()) {
if (grMember.group.exclude_manager.toString() == 'true' && groupManager == grMember.getValue('user')) {
// do nothing for this user as it's manager who is member and exclude flag is true
} else {
userArr.push(grMember.user.toString());
}
}
gs.info('Manager is excluded from the notification.');
gs.eventQueue('Exclude.manager', current, userArr.toString());
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2025 02:45 AM
It Is working but when exclude manager is false so that time notification is going to group members only not to the group manager. As per the OOB it should trigger to the manager.