Email notification on local administrator login

ServiceNow Use6
Tera Guru

Hi @Maik Skoddow ,

I have a requirement.

As a System Administrator, I need an email notification set up to send an alert when a local admin login occurs in the production environment to ensure that this account is not used unless absolutely necessary for security purposes. Kindly help.

Regards

Suman P.

1 ACCEPTED SOLUTION

What is local admin , if that a role like 'local_admin' if yes then below will work, Mark my answer as correct if that helps.

find_real_file.png

var answer = false;

var gr = new GlideRecord('sys_user_has_role');
gr.addQuery('user', current.sys_id);
gs.log("Current log in "+current.sys_id);
gr.addQuery('role', '9b947bfc1b97811039cdc843604bcb3b');

gr.query();
if(gr.next())
	{
			gs.log("Going inside");
		answer = true;
	}
else
	{
		gs.log("Not going inside");
		answer = false;
	}

Please hit like and mark my response as correct if that helps
Regards,
Musab

View solution in original post

8 REPLIES 8

Musab Rasheed
Tera Sage
Tera Sage

Hi @ServiceNow user ,

You can create notification on user table with condition like below, you can add additional condition as per requirement. Mark my answer as correct if that helps.

find_real_file.png

Please hit like and mark my response as correct if that helps
Regards,
Musab

Hi @Musab Rasheed ,

There are asking for production environment, how can i implement it?

Regards

Suman P.

You implement this in lower environment, get it tested and give update set to someone who has production access and they can deploy.? I hope that's what you are asking.?

Please hit like and mark my response as correct if that helps
Regards,
Musab

Hi @Musab Rasheed ,

Where are we saying that 'when an admin is logged in'?

Regards

Suman P.