
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 11-20-2021 11:01 AM
From the past couple of months, I have seen quite a few questions around making assigned to variable dependent on assignment group variable on catalog item or record producer. Its quite simple but it requires some platform and scripting knowledge.
There could be many approaches to achieve this simple task but below is how I and many of us would do it.
For the sake of demonstration, I have already created a sample item with two reference type variables; Assigned to [assigned_to] and Assignment Group [assignment_group].
Assignment group variable doesn't require any special configuration. However, we will need to apply advance reference qualifier on the assigned_to variable by following the below steps.
Problem Statement
When user select Assignment group on the form then Assigned to field must show filtered list of users that belongs to Selected Assignment group only
Solution
Step 1
Open the Assigned to variable and go to Type specifications tab and set the following values.
User Reference Qualifier - Advance
Reference Qualifier
Global Scope
javascript: filterAssignedTo(current.variables.assignment_group);
Scoped App
javascript: <scope_id>.filterAssignedTo(current.variables.assignment_group);
Variable attributes - ref_qual_elements=assignment_group
Screenshot for reference
Step 2
Create a script include with below configuration.
Name - filterAssignedTo
Script
function filterAssignedTo(group) {
var users = [];
if (group != '') {
var getGroupMembers = new GlideRecord('sys_user_grmember');
getGroupMembers.addQuery('group', group);
getGroupMembers.query();
while (getGroupMembers.next()) {
users.push(getGroupMembers.getValue('user'));
}
return 'sys_idIN' + users.toString();
} else {
return 'sys_idIN';
//return 'active=true'; //uncomment this line if you want to return all the active users if assignment group is not selected. Must Comment just above line.
}
}
Voila that's it!
Output
Filtered list of users based on the assignment group selected.
Hope you found it helpful. If so, why don't you bookmark it for future, hit helpful and give feedback in the comment box below.
Regards,
Muhammad
- 3,421 Views

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
hi
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thank you for sharing this is great.

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
What would need to change if I want to go the other way - I know the Assigned to, but don't know the Assignment Group they belong to?
Would it also be possible to use both on a Catalog Item?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
This is great info.. If I want to see only active members of that assignment group in assigned to then?
We have a group and when we select that group automatically that group manager is getting assigned and he is Inactive.. We want that group members to be added instead of that inactive manager in assigned_to field. Any idea on this?
TIA 🙂
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thanks for this. It works a treat. I thought there would have been an easier way to achieve this. For example, if I chose a group from a group reference catalog variable then the second variable i.e. members would only show members of the first variable group chosen. But there appears to be no declarative feature that does this.
Max