How to make "Assign to" dependent on "Assignment Group" in a record producer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2021 10:15 AM
We want to limit the user list under "Assigned to" on a record producer based on the selected "Assignment Group"...
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2021 08:00 PM
Can you please add some screenshot of your script include and variable configuration ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2021 06:21 AM
function filterAssignedTo(group) {
// function filterAssignedTo() {
var users = [];
// var group = '6a0059d42f2130103d48bcb62799b6b6';
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.
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2021 06:28 AM
Hi
Please try below
<scope_name>.filterAssignedTo(current.variables.assignment_group);
Please replace <scope_name> with your custom scope name. Also, ensure assignment_group variable is the correct name.
In the scoped application we call script include by its API name instead of name and I believe that's the main issue here.
Muhammad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2021 06:30 AM
Include the API name field value in your reference qualifier?
Quick Demo, this way create your script include.
in my case, i will call it like this way
javascript: new x_43765_aaaa.getAssignTo().filterAssignedTo(current.variables.assignment_group);
var getAssignTo = Class.create();
getAssignTo.prototype = {
initialize: function() {},
filterAssignedTo: function(group) {
// function filterAssignedTo() {
var users = [];
// var group = '6a0059d42f2130103d48bcb62799b6b6';
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.
}
},
type: 'getAssignTo'
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2021 08:44 AM
Are you referring to the Reference qualifier?
javascript: x_670770_my_scoped_app.getAssignTo().filterAssignedTo(current.variables.assignment_group);
Where x_670770_my_scoped_app.getAssignTo is the API name.
Also, assignment_group & assigned_to are the variable names on the Record Producer
But it is still not working for me...