Want to config reference qualifier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2023 07:11 PM
Hello All,
I have the following like users on my PDI.
-----
UserName:Service Desk / Role:service_desk
UserName:Service Desk1 / Role:service_desk
UserName:Soft Ware / Role:software
UserName:Soft Ware1 / Role:software
-----
I want to config reference qualifier for reference filed.(The reference is sys_user)
My requirements:
When Service Desk user references, he can only list by users with role service_desk.
In other word, Service Desk user can list only Service Desk1. He never list Soft Ware and Soft Ware1 user this scenario.
Conversely, Soft Ware user can list only Soft Ware1 and he never list Service Desk and Service Desk1 user this scenario.
I think that I need to create a script include, but I could not resolve...
Could you help me to resolve my requirements ?
Regrds,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 11:51 PM
Hi @matsui,
Allright, that part is clear. Do you work with Assignment groups?
If so, are members of Service Desk assignment group allowed to select other assignment groups, and just not the users, or shouldn't they select a group either?
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 09:14 AM
Those users are assigned each group, but which is not assignment groups.
It just is simple groups.
For example, when user was added Service Desk group, this user will have role of Service Desk.
That user should not select users of Software group in sys_user.
If I need to created assignment groups, I can do it.
How I can resolve for thus issue ?
Regards,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 12:53 AM - edited 09-15-2023 12:55 AM
Hi @matsui,
Since they are in groups, you could use this as script in the advanced reference qualifier:
javascript: var groups = gs.getUser().getMyGroups(); var userList; var users = new GlideRecord('sys_user_grmember');users.addQuery('group', 'IN', groups);users.query();while(users.next()){ userList+=users.getValue('user')+',';} 'sys_idIN'+userList
Replace : by ;
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 12:41 PM
Unfortunately, I tried to your code, but it didn't work as expected.
When I tried to select user, it doesn't show any users.
I created a new group and added some users to that group, but the result was same.
Regards,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2023 11:49 PM
Hi @matsui,
Thats strange, it works fine in my instance.
Can you share screenshots of your config?
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.