My Emails Gauge

Having a gauge that shows a user's sent emails is great for troubleshooting and reporting. Here is how to create one for your ServiceNow instance.

My Emails Gauge

NOTE: Be careful with performance of this gauge, the sys_email table can get large. However depending on the usage of this gauge or your instance size, you can run this gauge.

How to create the My Emails Gauge

Step 1: Create Report

1. Go to Reports > Edit
   Report: My Emails
   Type: List
2. Click Submit
3. This part is a trick. From the Reports list view, change the table of the My Emails Report to: sys_email.

Changing Table of My Emails Gauge

4. Open the My Emails Report, click view report and change these settings:

Columns: Created, Recipients, Subject
Visible to: Everyone
Filter: Recipients contains javascript:gs.getUser().email

NOTE: You may also want to add a condition to only display last week's emails or last month's emails.

5. Click the "Make Gauge" button on the My Emails Report

Step 2: Adjust Access Control

Adjust access control so that users can see their sent emails

1. Elevate your privilege to security admin.
2. Find ACL for sys_email read and adjust the script

Type: record
Operation: read
Name: Email [sys_email]

answer = acl_sys_email();

function acl_sys_email() {
if (current.target_table.nil())
return true;

var targetRecord = new GlideRecord(current.target_table);
return (targetRecord.isValid() && targetRecord.get(current.instance) && targetRecord.canRead()) || (current.recipients.indexOf(gs.getUser().email) > -1);
//Check the table is valid........the record can be seen(see below) ....and can be read by the current user
//The can be seen check is to make sure that the record is not hidden by a before query rule or by company/domain separation.

Add to Homepage

If you want to add to the ITIL Homepage for example.
1. Click Homepage Admin > Pages
2. Open ITIL Homepage
3. Click Edit Homepage
4. Click Add Content
5. Click Gauges > Email > My Emails

My Emails Gauge on Homepage