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

Musab Rasheed
Tera Sage

Try something like this and tweak accordingly. mark my answer as correct or hit like.

 

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

That assignment group is "External Vendors", should I add in-place of current.assignment_group??

@Koushik Ningaraju : Yes, add in single quotes and your condition in encoded query, it will work, no need for gliderecord as well , Mark my answer as correct or hit like based on impact

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

Thanks bro...Tanvi Jain, Jyoti p dalvi........all left this team. It's been very hard without proper mentors.