How can I hide an menu application based on role or group?

Allison3
Kilo Guru

I have a group that has an ITIL license but I'm need to hide the change application menu from them. When I edit the application menu I know I can make it visible based on a certain role. It can currently be seen by the admin or ITIL role, which needs to stay how it is. I'm wanting to limit a certain group or role from seeing this but keep them with an ITIL license. Is there a way to do this?

1 REPLY 1

Shay Faingold
Mega Expert

Hi,



I used this:


Can you restrict showing a module link by group instead of role?



as a reference to build this Business Rule - Before - Query on the Module table:



function onBefore(current, previous) {


  //This function will be automatically called when this rule is processed.




  var usr = gs.getUser();


      var loc = usr.getLocation();


      var cou = gs.getDisplayValueFor('cmn_location',loc,'country');


  var il = 'a533c91c6f208200ba1708c6eb3ee47f' ;


  var aus = '34afb6506fa08200ba1708c6eb3ee4f3';


  var uk = '0e57fc150f60420055d1c4dce1050e57';


  var gib = 'e40730550f60420055d1c4dce1050ef0';


  var bul = 'b004f0150f60420055d1c4dce1050e16';


  var usa = 'f434f8150f60420055d1c4dce1050e63';


  var man = '87547c150f60420055d1c4dce1050e89';



  if (gs.hasRole('admin')) {



  } else if (cou == 'United Kingdom') {


  current.addQuery('sys_id','!=', il);


  current.addQuery('sys_id','!=', aus);


  current.addQuery('sys_id','!=', gib);


  current.addQuery('sys_id','!=', bul);


  current.addQuery('sys_id','!=', usa);


  current.addQuery('sys_id','!=', man);


  } else if (cou == 'Israel') {


  current.addQuery('sys_id','!=', uk);


  current.addQuery('sys_id','!=', aus);


  current.addQuery('sys_id','!=', gib);


  current.addQuery('sys_id','!=', bul);


  current.addQuery('sys_id','!=', usa);


  current.addQuery('sys_id','!=', man);


  } else if (cou == 'Australia') {


  current.addQuery('sys_id','!=', uk);


  current.addQuery('sys_id','!=', il);


  current.addQuery('sys_id','!=', gib);


  current.addQuery('sys_id','!=', bul);


  current.addQuery('sys_id','!=', usa);


  current.addQuery('sys_id','!=', man);


  } else if (cou == 'Gibraltar') {


  current.addQuery('sys_id','!=', uk);


  current.addQuery('sys_id','!=', il);


  current.addQuery('sys_id','!=', aus);


  current.addQuery('sys_id','!=', bul);


  current.addQuery('sys_id','!=', usa);


  current.addQuery('sys_id','!=', man);


  } else if (cou == 'Bulgaria') {


  current.addQuery('sys_id','!=', uk);


  current.addQuery('sys_id','!=', il);


  current.addQuery('sys_id','!=', gib);


  current.addQuery('sys_id','!=', aus);


  current.addQuery('sys_id','!=', usa);


  current.addQuery('sys_id','!=', man);


  } else if (cou == 'USA') {


  current.addQuery('sys_id','!=', uk);


  current.addQuery('sys_id','!=', il);


  current.addQuery('sys_id','!=', gib);


  current.addQuery('sys_id','!=', aus);


  current.addQuery('sys_id','!=', bul);


  current.addQuery('sys_id','!=', man);


  } else if (cou == 'Phillippines') {


  current.addQuery('sys_id','!=', uk);


  current.addQuery('sys_id','!=', il);


  current.addQuery('sys_id','!=', gib);


  current.addQuery('sys_id','!=', aus);


  current.addQuery('sys_id','!=', bul);


  current.addQuery('sys_id','!=', man);


  } else {


      }


}



you can change the the filter based on Role / Group / Location.


the sys_id should represent the Module sys_id which you are trying to hide.



Let me know if you need assistance with that or if it helped you to get there on your own



Thank you,


Shay