Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 08:18 AM
Our users dislike the fact that once they choose a group, they have to select the applicable users one by one rather than a mass selection.
Is there a way to automatically populate the member_list field with ALL users from the chosen group, and they can then filter out?
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Community Alums
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 09:08 AM
Hi @MBarrott ,
Here you go:
Output:😍
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var member = new GlideAjax("getMembers");
member.addParam("sysparm_name", "userList")
member.addParam("groupid", newValue);
member.getXMLAnswer(output)
function output(result) {
g_form.setValue("u_member_list", result);
}
//Type appropriate comment here, and begin script below
}var getMembers = Class.create();
getMembers.prototype = Object.extendsObject(AbstractAjaxProcessor, {
userList: function(){
var members="";
var id = this.getParameter("groupid");
var grpMembers = new GlideRecord("sys_user_grmember")
grpMembers.addQuery("group", id);
grpMembers.query();
while(grpMembers.next()){
members+=","+grpMembers.user.toString();
}
return members;
},
type: 'getMembers'
});
Hope this helps!!!
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 09:41 AM