Want to config reference qualifier

matsui
Tera Contributor

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,

10 REPLIES 10

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.

Hi @Peter Bodelier 

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,

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.

Hi @Peter Bodelier 

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,

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.