Hide Application on left navigation bar based on groups

Community Alums
Not applicable

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

 

1 ACCEPTED SOLUTION

Alikutty A
Tera Sage

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!

View solution in original post

13 REPLIES 13

Hi Shruthi,

 

Did you figure out hiding an application menu for specific Group?

 

Thanks,

M.N

SaiRaviKiran Ak
Giga Guru

Try This:

(function executeRule(current, previous /*null when async*/) {

if(gs.hasRole("itil") && gs.getUser().isMemberOf('Test Group'))  //Add proper group name here
{
current.addQuery('sys_id','!=','deecb70ec611228700bafda6dde05102');//sys_id of the application
}
}

Community Alums
Not applicable

Hi SaiRaviKiran,

 

Thanks for your reply.

 

I tried the above. It did not work. 

 

find_real_file.png

 

 

Any advice?

 

Thanks

Add info message in If loop and check.

Impersonated user from test group and see. Also impersonate user from other group and verify the info message.

Community Alums
Not applicable

Hi,

 

I did not get the Info message in both cases. This means the BR is not running right?

 

Any idea what's the issue here? Anything related to system cache?

 

Thanks