Making Assignment Group and Assigned to inter-dependent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2023 11:06 AM - edited 03-20-2023 11:07 AM
Hi everyone,
I have a requirement that I thought would be pretty easy but I can't figure it out.
Also, I thought I would find the solution quickly by googling but no success. Maybe I'm not searching for the right keywords.
In the Incident form, I want to do the following:
- If I choose a group in Assignment group field, I want choices in Assigned to field filtered to only group members (OOB)
- Vice versa, if I first choose a user in Assigned to field, I want choices in Assignment group field filtered to only groups that user belongs to (not OOB)
How do I achieve this? Please help!
thanks - Parker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2023 06:14 PM - edited 03-20-2023 07:28 PM
so i think natively, you're not going to get this.
on the Assigned To field, you can configure the dictionary and select the "dependent" field of "assignment group" (whatever your assignment group field is)
then when you set your assignment group, you'll get only the group members.
however, i dont believe this works the other way around.
You'd have to write a filter that gets the assigned to, and then looks at the available groups. but if the assigned to is blank, then returns all groups.
edit the dictionary of the Assignment Group:
Change the "Use Reference Qualifier" to "Advanced"
set the Reference Qual to:
javascript : new getUserGroups().getGroups(current.assigned_to)
Then create a script includes:
Name: "getUserGroups"
Script:
var getUserGroups = Class.create();
getUserGroups.prototype = {
initialize: function() {},
getGroups: function(user) {
if (user) {
var groups = [],
grGroupMember = new GlideRecord("sys_user_grmember");
grGroupMember.addQuery('user', user);
grGroupMember.query();
while (grGroupMember.next()) {
groups.push(grGroupMember.group.sys_id.toString());
}
return "sys_idIN" + groups;
} else {
return "active=true";
}
},
type: 'getUserGroups'
};
Where the "active=true" is where you'll want your default filter for the assignment group if the assigned to is blank.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2024 04:52 AM
Hi everyone did this solution work ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2024 06:45 PM
This has worked for me for years.
i just tried this exact solution in a PDI.
When i set the group, the assigned to is dependent on the Group.
When i set the user, it is limited to only the assigned to's group list.
So, it takes about 2 minutes to setup. give it a shot yourself.