Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

email notification for impersonate users

sanjay42
Tera Contributor

Hi,

I need when admin check with impersonate user while select anyone user then email send to that impersonate user.. with message like one of admin(name) accessed your account with admin access...

i am searched in community for this i got

How to Enable Email Notification on Impersonation Event

but in this article configured u_impersonation table but in my instance i don't   have that table..

Thanks

Sanjay

1 ACCEPTED SOLUTION

Hi Sanjay,



You can create a new notification for the same using OOB events called "impersonation.start" and "impersonation.end"



Name : Impersonate User


Table : User {The event impersonation.start is registered to this table}


Send When : Event is fired


Event Name : impersonation.end


Users : admin //you can keep any user you want to send


Send to event creator : checked


Subject : Account was impersonated.


Message HTML :



<mail_script>


var gr = new GlideRecord('sys_user');


var abc = event.parm2;


gs.log(abc,"mru");


gr.addQuery('user_name',abc);


gr.query();


if(gr.next())


{


template.print("Hi "+gr.first_name+",");


email.addAddress('cc',gr.email);


}


</mail_script>



Your account was impersonated using ${event.parm1} account.


View solution in original post

11 REPLIES 11

sanjay42
Tera Contributor

thanks for reply,




please give me any sample code..


Hi Sanjay,



You can create a new notification for the same using OOB events called "impersonation.start" and "impersonation.end"



Name : Impersonate User


Table : User {The event impersonation.start is registered to this table}


Send When : Event is fired


Event Name : impersonation.end


Users : admin //you can keep any user you want to send


Send to event creator : checked


Subject : Account was impersonated.


Message HTML :



<mail_script>


var gr = new GlideRecord('sys_user');


var abc = event.parm2;


gs.log(abc,"mru");


gr.addQuery('user_name',abc);


gr.query();


if(gr.next())


{


template.print("Hi "+gr.first_name+",");


email.addAddress('cc',gr.email);


}


</mail_script>



Your account was impersonated using ${event.parm1} account.


Hi Mrudula Manjrekar



Table : User {The event impersonation.start is registered to this table}



The above table is a sys_user table or anything else???


sys_user


Community Alums
Not applicable

Can we trigger an impersonation start event when a particular group user is impersonated?