Need help with script to make it so that two groups can't be seen on the pick list for everybody except those two groups.

Lee Kraus2
Tera Guru

So here is an example I found and slightly massaged already:

 

if(!gs.getUser().isnotMemberOf('sys_id')){ //sys_id of group to check if user is a member of
    current.addQuery('sys_id','!=','sys_id_of_group_to_hide');
}

 

(In that example, I changed !gs.getUser().isMemberOf('sys_id') to .isnotMemberof and it seems to work as an option)

 

I'm editing the script under Business Rules > group query that uses the Group [sys_user_group] table. I left the default JavaScript alone: if (!gs.hasRole("admin") && gs.getSession().isInteractive()) {current.addQuery("active", "true");} (edited here to be on one line). 

 

I'm trying to get two of our groups to not get tickets back assigned to them, essentially I need them to not show up on the Assignment Group dropdown of other groups. Currently if I use just this line of code and put in the sys_id of one of GroupA in the top argument, and put sys_id of GroupB in the spot of sys_id_of_group_to_hide that group becomes invisible to anyone except GroupA, including anyone in GroupB, so, not ideal. 

 

So what I'm asking for help here is how to I make it so that GroupA and GroupB see all the groups on the dropdown menu, but the other groups don't see GroupA or GroupB. I feel I'm close, but I don't have the coding experience to get this nailed down. 

 

All help is greatly appreciated!

1 ACCEPTED SOLUTION

Muhammad Khan
Mega Sage
Mega Sage

Hi Lee,

As per my understanding of your requirement, you can create an onDemand function using Script Include, and call it in the Override reference qualifier for assignment_group field of incident table.

For reference see the below images.

find_real_file.png

find_real_file.png

 

Hopefully, this will help you resolve your query.

View solution in original post

6 REPLIES 6

Mark Manders
Mega Patron

Not sure how far you are already, but please don't use the Query BR for this. That will work on the groups list as well!


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Lee Kraus2
Tera Guru

Well I don't think I've done any Query Business Rules on this anymore, I've removed any test scripts that were in my original question and moved on to trying the suggested answer first given. I definitely ran into that problem where the groups "disappeared" on my groups list 

I added your script and it looks like it works Mark, thank you!