Before Query Business rule Restrict by Group type
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2023 05:06 PM
Hello community,
I came across the following requirement, we need to show Restrict some incident records by Group Type so for example I have several groups, Group Apples, Group Mango, Group Bananas etc these groups have a Group type = Fruit I need to Restrict/Hide some incident records Only IF the Assignment group Type is Fruit and If the user is member of The assignment group, so for example if Jane Fonda is member of any group where the Type is FRUIT she should be able to see
I was trying the following
Condition field : !gs.hasRole('admin')
var query = current.addNullQuery('assignment_group').addEncodedQuery('assignment_group.typeLIKE45f5ee841b6c6d10bf11877ae54bcbe4');
Also I tried the following:
var grp = current.addEncodedQuery('assignment_group.typeLIKE45f5ee841b6c6d10bf11877ae54bcbe4');
But only shown incident records with these types, we need to show also other incident records

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2023 07:35 PM
Hi @GM5 ,
In the when to run condition you need to mention as assignment group type is Fruit
In the script
var currentUser = gs.getUser();
var groupNames = //get the group names here
if (currentUser.isMemberOf("Group Name")) { //Add as many groups as you want using || condition
current.addQuery("assignment_group","IN",groupNames)
}
Please mark correct if my response has solved your query.
Cheers,
Mohammed Basheer Ahmed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2023 08:08 AM
So I'm trying to understand, the variable GroupNames, what do you mean with that variable? to add the groups where the Type is Fruit? Or current user Groups? then the conditional evaluates what?