- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2020 01:09 AM
Hello all,
I am wondering how can an admin user override a business rule?
What do I need to configure in my BR?
Regards,
Smith.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2020 01:13 AM
Hi,
for query business rule we usually add these 2 conditions
1) so that it doesn't run for admin as admin can see all data; depends on company process
2) this BR doesn't run when GlideRecord query is performed on this table
BR Condition:
gs.getSession().isInteractive() && !gs.hasRole('admin')
gs.getSession().isInteractive() -> this BR will only run when working in interactive session i.e. UI etc
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2020 01:11 AM
Hi,
You dont want the BR to run for admin then in condition field under advance section write this line
!gs.hasRole('admin')
So this will not run for admin users.
Thanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2020 01:12 AM
Hi,
if this is for query business rule then add this in the condition
!gs.hasRole('admin')
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2020 01:13 AM
Hi,
for query business rule we usually add these 2 conditions
1) so that it doesn't run for admin as admin can see all data; depends on company process
2) this BR doesn't run when GlideRecord query is performed on this table
BR Condition:
gs.getSession().isInteractive() && !gs.hasRole('admin')
gs.getSession().isInteractive() -> this BR will only run when working in interactive session i.e. UI etc
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2020 01:19 AM
thanks for your reply.
Could you please give me a simple example, to understand the importance of gs.getSession().isInteractive() condition?
The condition: !gs.hasRole('admin') is clear to me, but I cannot understand why should I need the other one.