additional filtering on advanced ref qualifier: assignment_group

Bcrant
Tera Contributor

Hello, all.

 

I recently setup an advanced reference qualifier on our assignment_group field to return groups that the assigned_to user is a member of. I'd like to further filter that query to show only a specific group type of "itil" and hoping one of you cold assist. Below is the script we're using...

 

javascript: 'sys_idIN' + new global.ArrayUtil().convertArray(gs.getUser().getUserByID(current.assigned_to.toString()).getMyGroups())

1 ACCEPTED SOLUTION

AnveshKumar M
Tera Sage
Tera Sage

Hi @Bcrant ,

 

Try the following Reference Qualifier.

 

javascript:'typeLIKE1cb8ab9bff500200158bffffffffff62^sys_idIN' + new global.ArrayUtil().convertArray(gs.getUser().getUserByID(current.assigned_to.toString()).getMyGroups())

 

In the above statement replace : next to javascript with :

 

Please mark my answer helpful and accept as solution if it helped you 👍

 

Thanks,
Anvesh

View solution in original post

5 REPLIES 5

AnveshKumar M
Tera Sage
Tera Sage

Hi @Bcrant ,

 

Try the following Reference Qualifier.

 

javascript:'typeLIKE1cb8ab9bff500200158bffffffffff62^sys_idIN' + new global.ArrayUtil().convertArray(gs.getUser().getUserByID(current.assigned_to.toString()).getMyGroups())

 

In the above statement replace : next to javascript with :

 

Please mark my answer helpful and accept as solution if it helped you 👍

 

Thanks,
Anvesh

Not sure why it copied that way but ":" is present. Thanks for reply ✌️

@Bcrant it is because ServiceNow escapes them to prevent that script being executed.

 

Any way did it helped you to fix the issue? If it is please accept my answer as solution 

Thanks,
Anvesh

Murthy Ch
Giga Sage

Hey @Bcrant 

I would not recommend your code because for example if you are part of a child group and if the child group has a parent group then it will also return the parent groups even if you are not a member of the parent groups. So, apply your logic if you don't want to return the parent groups. 

 

Let me know if any confusion.

Happy to help:)

 

Murthy

Thanks,
Murthy