Restrict assignment group based on Category
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2023 05:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2023 10:55 AM
Your reference qualifier override would look like this:
The Client callable Script Include would do a GlideRecord query on the sys_user_group table if the category (argument in function, passed in from reference qualifier) value is one of your two choices. You can use setLimit to only return 2 records if you truly mean any 2 groups, or whatever your criteria is, pushing each sys_id to an array. Return the array like this:
return 'sys_idIN' + grpArr.join(',');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2023 11:12 AM - edited 10-08-2023 11:21 AM
Hi @KrishnaMoorthyH ,
You can write script include like below.
var AssignmentGroupFilter = Class.create();
AssignmentGroupFilter.prototype = {
initialize: function() {},
filterAssignmentGroups: function(category) {
var validAssignmentGroups = [];
if (category === 'Inquiry/help' || category === 'Software') {
var groupGR = new GlideRecord('sys_user_group');
groupGR.addEncodedQuery('copy2group_sys_id_queryfrom_tableand copy');
groupGR.setLimit(2);
groupGR.query();
while (groupGR.next()) {
validAssignmentGroups.push(groupGR.getUniqueValue());
}
}
return 'sys_idIN'+validAssignmentGroups.join(',');
},
type: 'AssignmentGroupFilter'
};
In Reference Specification Tab-Reference qualifier in assignment group field add below script-
javascript : new AssignmentGroupFilter().filterAssignmentGroups(current.category);
Please mark it as Solution Proposed and Helpful if it works for you.
Thanks,
Anand