In some ServiceNow customer instances, there are certain accounts in ServiceNow that are to be used infrequently, like the “admin” account or certain executive accounts. Here is a simple way to keep track on those selected users via email notification.
This customization will send an email to a selected email address if the admin user logs in. You can also configure this for other accounts or roles, but this example should get you started:
Business Rule
Name: Admin Login Event
Table: User [sys_user]
When: after
Insert/Update: true
Order: 100
Active: true
Script:
if (!current.last_login_time.nil() && current.last_login_time.changes() && current.user_name == 'admin') {
gs.eventQueue("admin.login", current, current.user_name , current.user_name);
}
Registry
Name: admin.login
Table: User [sys_user]
Fired By: Admin User Login Event Business Rule
Description: Admin User Login Event
Email Notification
Name: Admin Login Notify
Event: admin.login
Table: user [sys_user]
User: <email address you want to send it to>
Subject: Admin Login Notification
Message:
Supporting Files