notifications are going to external email in servicenow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2024 01:28 AM
I want to find out which notifications are going to external emails?
do we need to write script or what can we do can anybody please tell me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2024 02:54 AM
Hi @harsha vv,
All emails sent (and received) are logged within with Email System Logs. Type 'Emails' into the Navigation menu and click on the link under 'System Logs'.
From here you can adapt the filter accordingly:
- Created is This week (Select the date range you want to check for - eg This week or Last month etc)
- Type is Sent
- Recipients does not contain (your internal email address naming convention which identifies 'external' or non-internal emails such as @abc.com for example)
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.

Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2024 05:06 AM
Hi @Robbie,
thanks for the reply, In my instance for one email id I have 30 to 40 notifications I want to group them, but I am unable to do recipients group by. Can you check on this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2024 05:55 AM
hi @harsha vv
you can try bellow script in background script;
var emailAG = new GlideAggregate('sys_email'); // Using GlideAggregate for the Email table
emailAG.addQuery('type', 'sent'); // Filter for sent emails
emailAG.addAggregate('COUNT'); // Specify that you want to count the records
emailAG.groupBy('recipient'); // Group by the recipient (optional)
emailAG.query(); // Execute the query
if (emailAG.next()) {
var count = emailAG.getAggregate('COUNT'); // Get the count of sent emails
gs.info('Total notifications sent to emailId : '+emailAG.recipient+' ' + count);
} else {
gs.info('No notifications found for ' + emailId);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2024 07:20 PM
Hi @Rajesh Chopade1,
Thanks for the reply, I also want what notifications are going to external email id