Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Security Admin Elevate Issue

SandeepKSingh
Kilo Sage

Hi Team,

 

How can you set up a notification in ServiceNow to alert a specific group when a user elevates their role to security_admin?

2 ACCEPTED SOLUTIONS

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @SandeepKSingh 

 

https://www.servicenow.com/community/developer-forum/notification-on-security-admin-role-elevation/t...

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

View solution in original post

Ravi Gaurav
Giga Sage
Giga Sage

@SandeepKSingh 

 

 The problem

A user wants to trigger a notification when a user is elevated to the “security_admin” role. In the post:

  • They note that when a user is elevated to the role, an event with name security.elevated_role.enabled is generated. In that event:

    • parm1 holds the user ID of the user who got elevated. ServiceNow+1

    • parm2 holds the value “security_admin”. ServiceNow

  • They created a Notification (Send When → Event is fired → event name = security.elevated_role.enabled). ServiceNow

  • Then, they added an Advanced Condition Script to filter further:

     
    function elevated() { var sysEventGr = new GlideRecord('sysevent'); sysEventGr.addQuery('sys_id', event.name.toString()); sysEventGr.query(); if (sysEventGr.next()) { if (sysEventGr.parm2 == "security_admin") { gs.print(sysEventGr.parm2); return true; } } }

    They expected it to check that parm2 == "security_admin" and only trigger if so. ServiceNow

  • The issue: Even though the script works when run in background, the Notification did not trigger when the role elevation happened in production. ServiceNow


🛠 The solution

A reply from a ServiceNow Employee suggests a simpler approach:

 

 
if (event.parm2 = 'security_admin') { answer = true; } else { answer = false; }

Which avoids querying the sysevent table entirely. ServiceNow

So instead of loading a GlideRecord, just use the event object directly in the Notification advanced condition.

So follow the below Article :-

https://www.servicenow.com/community/developer-forum/notification-on-security-admin-role-elevation/t...

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

 YouTube: https://www.youtube.com/@learnservicenowwithravi
 LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/

View solution in original post

3 REPLIES 3

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @SandeepKSingh 

 

https://www.servicenow.com/community/developer-forum/notification-on-security-admin-role-elevation/t...

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Ankur Bawiskar
Tera Patron
Tera Patron

@SandeepKSingh 

is this a valid business requirement?

In PROD very limited set of users belonging to Particular Group will have security_admin role.

Why would they need this?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ravi Gaurav
Giga Sage
Giga Sage

@SandeepKSingh 

 

 The problem

A user wants to trigger a notification when a user is elevated to the “security_admin” role. In the post:

  • They note that when a user is elevated to the role, an event with name security.elevated_role.enabled is generated. In that event:

    • parm1 holds the user ID of the user who got elevated. ServiceNow+1

    • parm2 holds the value “security_admin”. ServiceNow

  • They created a Notification (Send When → Event is fired → event name = security.elevated_role.enabled). ServiceNow

  • Then, they added an Advanced Condition Script to filter further:

     
    function elevated() { var sysEventGr = new GlideRecord('sysevent'); sysEventGr.addQuery('sys_id', event.name.toString()); sysEventGr.query(); if (sysEventGr.next()) { if (sysEventGr.parm2 == "security_admin") { gs.print(sysEventGr.parm2); return true; } } }

    They expected it to check that parm2 == "security_admin" and only trigger if so. ServiceNow

  • The issue: Even though the script works when run in background, the Notification did not trigger when the role elevation happened in production. ServiceNow


🛠 The solution

A reply from a ServiceNow Employee suggests a simpler approach:

 

 
if (event.parm2 = 'security_admin') { answer = true; } else { answer = false; }

Which avoids querying the sysevent table entirely. ServiceNow

So instead of loading a GlideRecord, just use the event object directly in the Notification advanced condition.

So follow the below Article :-

https://www.servicenow.com/community/developer-forum/notification-on-security-admin-role-elevation/t...

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

 YouTube: https://www.youtube.com/@learnservicenowwithravi
 LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/