The CreatorCon Call for Content is officially open! Get started here.

Before Query Business rule Restrict by Group type

GM5
Giga Guru

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

2 REPLIES 2

Basheer
Mega Sage

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 hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.

Cheers,
Mohammed Basheer Ahmed.

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?