- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
an hour ago
Problem - You have a "Select Group" field and a "Select User" field. e.g If a user picks "HR Support," they shouldn't have to scroll through 5,000 IT technicians to find the right person. Leaving fields wide open is a recipe for bad data and frustrated users
Sol - put together a solution using an Advanced Reference Qualifier and a Script Include.
Script Include -
var getMemberOfgroups = Class.create();
getMemberOfgroups.prototype = {
initialize: function() {},
getMembers: function(groupId,action) {
var idList = [];
var groupArray = groupId.split(',');
if(action == "remove"){
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery("group", "IN", groupArray);
gr.query();
while (gr.next()) {
idList.push(gr.getValue("user"));
}
if (idList.length > 0) {
return "sys_idIN" + idList.join(',');
} else {
return "sys_idINEMPTY";
}
}
},
Reference qualifier -
javascript: new getMemberOfgroups().getMembers(current.variables.select_groups, current.variables.do_you_want_to_add);
