Notification sends duplicated emails to the assigned_to user and the same user from assignment_group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi All,
We have a notification which is sent to Users/Groups in fields: assignment_group, assigned_to.
The requirement is to send the notification to assigned_to user, and only IF assigned_to is empty, send it to the assignment_group, so that no duplicated emails are fired to the assigned_to and assignment_group for the same customer communication update.
Does anybody know how to accomplish this?
Thank you in advance for any suggestions, or hints.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago - last edited 2 hours ago
Hi @kandulek,
There are basically 2 approcahes, you can select any one of them, but most recommended is first one:
Option 1: Use a Scripted Recipient (Recommended):-
1. Open your Notification in ServiceNow.
2. In the "Who will receive" section, remove any static entries for assigned_to or assignment_group.
3. Click "Advanced view" and add a Scripted Recipient.
Use the following script:
// 'current' is the GlideRecord of the triggering record (e.g., incident, task)
if (current.assigned_to)
{
// Send only to the assigned user
recipients.push(current.assigned_to);
}
else if (current.assignment_group)
{
// Send to all members of the assignment group
var grMembers = new GlideRecord('sys_user_grmember');
grMembers.addQuery('group', current.assignment_group);
grMembers.query();
while (grMembers.next()) {
recipients.push(grMembers.user);
}
}
Option 2: Use Conditions + Two Notifications (Alternative)
If you prefer not to script:
Create two separate notifications:
Notification A: Condition = assigned_to is not empty, recipient = assigned_to
Notification B: Condition = assigned_to is empty AND assignment_group is not empty, recipient = assignment_group
This avoids scripting but may be harder to maintain if logic changes.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Thanks,
Anupam.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hello @kandulek ,
Create 2 notifications with below approach
Notification 1: Triggers only when Assigned To is empty and sends the email to the Assignment Group.
Notification 2: Triggers only when Assigned To not empty and sends the mail directly to that assigned to user.
If my response helped, please mark it as the accepted solution ✅ and give a thumbs up👍.
Thanks,
Anand
