Hi All, I need a before query business rule that checks for a group membership of the currently logged-in User and returns some filtered/queried records from the sys_user_group table (having u_hidden value as true)?

Koushik Ningara
Tera Contributor

Need a before Query business rule which checks for a group membership of the currently logged-in User and returns some filtered records from sys_user_group table having field value Hidden=true.

1 ACCEPTED SOLUTION

Meera11
ServiceNow Employee
ServiceNow Employee

if(gs.getUser().isMemberOf(current.assignment_group)){

var gr = new GlideRecord("sys_user_group");

gr.addEncodedQuery("u_hidden=true") // copy query link from sys_user_group_table 

gr.query();

{

 

add remaining logic

}

}

 

Mark Correct/ helpful if this helped you

View solution in original post

10 REPLIES 10

It worked , Thanks

@Koushik Ningaraju : Please mark my first reply as 'Correct answer' so that it will help others.

 

find_real_file.png

Please hit like and mark my response as correct if that helps
Regards,
Musab

Hello @Koushik Ningaraju ,

Looks like you have incorrectly marked other answer as correct instead of mine below as you stated that my logic had worked fine, no need for gliderecord in BR or else it might affect performance but if my logic didn't work then fine.

find_real_file.png

Please hit like and mark my response as correct if that helps
Regards,
Musab

Hello @Koushik Ningaraju : As I have answered your query, Please mark my answer as correct so that it will help others.

Please hit like and mark my response as correct if that helps
Regards,
Musab

Meera11
ServiceNow Employee
ServiceNow Employee

if(gs.getUser().isMemberOf(current.assignment_group)){

var gr = new GlideRecord("sys_user_group");

gr.addEncodedQuery("u_hidden=true") // copy query link from sys_user_group_table 

gr.query();

{

 

add remaining logic

}

}

 

Mark Correct/ helpful if this helped you