- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-27-2022 04:11 AM
when i select group then only particular group members visible in list collector.i have achieve this but group members are visible in right side box(selected). but i want only particular group members display in left side block.
Solved! Go to Solution.
- Labels:
-
Personal Developer Instance

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-28-2022 02:21 AM
Hello poornima,
But the idea of the field is exactly the oposite.
The right box represent the "selected" users and the left the "users to select".
If you want to select a group and have all members selected, then you need to:
- Create a client script onChange of the group field
- In that client script, perform an ajax call to retrieve the members of the group (I think your script is doing this)
- set the field with the members with the value that is being returned from your ajax call.
This way you will set that field to be the set of members of the group. In that way you will see all members on the right side when selecting the group.
I'm not entirely sure about the output of your script: maybe it should only return a comma-separated list of user sys_ids. You need to try it out.
Let me know if this solution had any positive outcome.
Hope this helps!
Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!
Best Regards,
Filipe Cruz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā12-19-2022 12:20 PM
Hi @poornima srivas ,
I'm trying to achieve exactly what you managed to, but for some reason it's not working. Can you spot any errors?
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ga = new GlideAjax('getGroupName');
add.Parm('sysparam_name','getGroupMembers');
add.Parm('sysparm_gid','newValue');
ga.getXML(callback);
function callback(response)
{
var answer = response.resonseXML.documebntElement.getAttribute("answer");
//var memArray=anwer.split('|');
//var memNames = memArray[0];
//var memValue = memArray[1];
alert(answer);
g_form.setValue("members_text",answer);
}
//Type appropriate comment here, and begin script below
}
var getGroupName = Class.create();
getGroupName.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getGroupMembers: function() {
var grpID = this.getParameter('sysparm_gid');
var memObj = new GlideRecord('sys_user_grmember');
memObj.addQuery('group', grpID);
memObj.query();
var nArray = [];
var vArray = [];
while (memObj.next()) {
nArray.push(memObj.user.getDisplayValue().toString());
vArray.push(memObj.getValue("user").toString());
}
var retValue = nArray.toString() + '|' + vArray.toString();
return retValue;
},
type: 'getGroupName'
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-20-2023 04:27 AM
your query should be something like this (Try this in background thou)