Want to hide a sub-module based on group

Deepa Karthiga
Tera Contributor

Hi,

I have created a module under service catalog -> open records. Want to display the module only to a group. Please suggest how to achieve it

Thanks in advance

1 ACCEPTED SOLUTION

snehabinani26
Tera Guru
7 REPLIES 7

snehabinani26
Tera Guru

Hi Deepa,



Have done the same kind of requirement for one of any customer in the below mentioned way. .



1.Write a before query business rule on Module(sys_app_module) table .



2.In condition check if the login user is part of that group.




3.In the script condition write :



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



current.addQuery('sys_id', '!=', 'SYS_ID OF MODULE/SUB-MODULE YOU WANT TO HIDE');




})(current, previous);



This will hide that particular module/sub-module from the person having membership of that group . I hope this helps .


Hai @snehabinani26 
 
we are working on same requirement but we have two groups
1. procurement
2. legal team
 
And we have 2 modules on contract form like:
 
1. procurement
2. legal 
 
Here when procurement users logged 
 
its shows only procurement module
 
we written yours script its working for 1 group users 
 
we written same script for another legal group
 
its not working
 
if you known help me this requirement
 
 
Thanks ,
Saikrishna 
                                                                            

snehabinani26
Tera Guru

find_real_file.png


Hi Sneha,



Thanks for you quick response. I tried it, but it is not working for me.


Here is my script. Please correct me if am wrong.



executeRule();


function executeRule(){


if(!gs.getUser().isMemberOf('Hardware'))


    {


    current.addQuery('sys_id','!=','bea2f162db1103002bdc7b1ebf9619be');//sys_id of the application


    }


}