Trigger emails to the group members alone from a scheduled job
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2025 11:47 PM
Hi,
I am passing the sys_id of the group as Event parm1, using gs.eventQueue from a scheduled job.
The event is getting triggered and the notifications are sent to the group members and also to the group manager.
How can I stop sending emails to group manager, the email has to be sent to the group members alone.
Thanks!
Ram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2025 12:51 AM
@Shubhras @SumanthDosapati @shantanu_patel8
Exclude manager works here to exclude the manager from the notification which was triggered from a event fired by a scheduled script execution.
Thanks!
Ramkumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2025 12:27 AM
Hi @shantanu_patel8 ,
Thanks for the reply.
The event was executed by the admin user and the BR was also triggered by the admin user, And run as field in the scheduled job was empty. So admin user has access to the manager field of the group. But it behaves differently.
Thanks!
Ram

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2025 12:37 AM
Can you share the script to retrieve the recipients which you tried. It would be easy to help from that.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2025 12:44 AM - edited 05-13-2025 12:45 AM
@Ramkumar Thanga - To stop sending email notifications to the group manager and send them only to the group members when triggering an event via gs.eventQueue with the group's sys_id as event parm1, you can leverage the "Exclude Manager" functionality on the group record.
Key points and solution:
- On the group record (sys_user_group), there is a checkbox field called Exclude Manager. When this is checked, the group manager will not receive notifications sent to the group, and only the group members will get the email.
- To implement this, ensure that the Exclude Manager checkbox is checked on the group record you are passing as parm1 in the event. This will automatically exclude the manager from receiving the notification.
- If you want to control this behavior programmatically, you can customize the notification's "Recipients" script or the business rule that triggers the event to exclude the manager user explicitly. For example, query the group members and filter out the manager before sending the notification:
javascript
var group = new GlideRecord('sys_user_group');
if (group.get(eventParm1)) {
var groupManager = group.manager.toString();
var userArr = [];
var grMember = new GlideRecord('sys_user_grmember');
grMember.addQuery('group', group.sys_id);
grMember.query();
while (grMember.next()) {
if (grMember.user.toString() != groupManager) {
userArr.push(grMember.user.toString());
}
}
// Trigger event or send notification to userArr only
gs.eventQueue('your.event.name', current, userArr.toString());
}
- Alternatively, if using notifications triggered by events, set the notification's recipient to "Users in fields" and select the group members, making sure the "Exclude Manager" checkbox is checked on the group, so the manager is not included.
- Note that the "Include Members" and "Exclude Manager" flags on the group record control whether members and the manager receive notifications. Setting Exclude Manager = true and Include Members = true results in emails going only to members, excluding the manager.
In summary, to stop sending emails to the group manager and send only to group members, check the Exclude Manager box on the group record and ensure your notification or event logic respects this setting. If needed, filter out the manager explicitly in your script before calling gs.eventQueue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2025 01:02 AM
did it not work with "Exclude manager" checkbox?
If not then you will have to use business rule, event based logic and in that BR script, get all the group members and exclude the group manager from that array
Then use gs.evenQueue() and send the recipients in parm1
In notification you can use "Event parm1 contains recipient" as true
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