- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2022 08:52 PM
Hi everyone , thanks in advance .
When we change assignment group , show all group members in watch list (list collector type field).
Please provide suggestion
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2022 11:42 PM
Hello,
Please use the below script:-
1) Write the below onchange client script of field assignment group:-
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var ga = new GlideAjax('GetGrpmembers');
ga.addParam('sysparm_name', 'GetGrp');
ga.addParam('sysparm_group_name', g_form.getValue('assignment_group'));
ga.getXML(HelloWorldParse);
function HelloWorldParse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
var fields = [];
fields = JSON.parse(answer);
for (i = 0; i < fields.length; i++) {
g_form.setValue("watch_list", fields[i]);
}
}
}
Then write a script include with the below script:-
var GetGrpmembers = Class.create();
var arr = [];
GetGrpmembers.prototype = Object.extendsObject(AbstractAjaxProcessor, {
GetGrp: function() {
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', this.getParameter('sysparm_group_name'));
gr.query();
while (gr.next()) {
arr.push(gr.user.toString());
}
var setMembers = JSON.stringify(arr);
return setMembers;
},
type: 'GetGrpmembers'
});
Now once you have both the script as soon as you select assignment group all the members will be populated on watchlist .
Please mark my answer correct/helpful based on Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2022 09:06 PM
Hey Prashant,
To confirm my understanding of your requirement, are you wanting to automatically populate the watch list with the group members? Or restrict the reference qualifier to only allow adding these users?
Either of the above would be possible - the former could get driven by a business rule or flow trigger. Restricting the reference qualifier for the slushbucket would be a little harder if you wanted to do it dynamically instead of setting it as standard, which you could do with a dictionary override for example.
Secondly, what outcome would this serve for you? Is this to ensure the assignment group members get notified appropriately? As that could happen through notifications.
Kind regards,
Astrid Sapphire
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2022 09:20 PM
Hi , we have to show all members of selected assignment group in watch list

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2022 09:08 PM
Hi,
You can use an onChange client script that makes an asynchronous call to a Script include function to get group members when group is changed. Alternatively, you could also use a Business Rule or Flow Designer to populate the field if you choose to do it at the server side.
But you may want to check the business requirement for this. Watch list usually contains users who would want to be informed or be part of an incident. So why would you want to add group members to watch list when they are already part of the assignment group and have visibility of the incident ?
Thanks,
Arav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2022 09:22 PM
Hi they asked me to this via script in interview,
i tired but able to show only 1 user in watch list.
can you please provide code.