- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2019 10:05 PM
Hi,
We have a requirement to Hide an Application if a user is part of group "Test Group". I have written a Before Query Business rule to achieve the same, however the same seems to be not working.
I am on Kingston version.
My BR is :
When: Before Query
Script:
function onBefore(current, previous) {
if(gs.hasRole("itil") && (gs.getUser().isMemberOf('Test Group')))
{
current.addQuery('sys_id','!=','deecb70ec611228700bafda6dde05102');//sys_id of the application
}
}
Any advice on what is the issue here or if there is an alternate solution to the same?
Your help is appreciated in advance.
Thank You
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2019 10:32 PM
Hello,
I don't think before query BR would work on the application navigation as it is not a list view. This works only on list views.
You will need to create a new role and add it on the application menu or required modules and the user should not be tagged with that role if you want to hide it.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2019 03:23 AM
Can you share you code with info messages?
Make sure that you impersonated a right user(User from test group )
Make sure that the user has ITIL role
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2020 08:08 PM
Query BR does not work on the applications. THey work only on the records against the table in list view.
Thanks,
Rahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2019 10:32 PM
Hello,
I don't think before query BR would work on the application navigation as it is not a list view. This works only on list views.
You will need to create a new role and add it on the application menu or required modules and the user should not be tagged with that role if you want to hide it.
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2020 12:55 PM
Before BR actually works in this case. It has to be called on sys_app_module table however.
It is well described on page 406 of Mastering ServiceNow 2nd edition book.
Since the original post is more than 1 year old let me know if you still need help with that.