- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2022 01:39 PM
I need to auto populate the watchlist with the assignment group that have been selected on an incident form and it change in real time. so if it in hard the watchlist will have all the group member, when it in software, the watchlist should be change to the software group member, when it blank the watchlist should also be blank. How do i get a group on the watchlist when you can only pick on the user table?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2022 01:12 AM
Hi @edwardwong ,
In that case use below client script and script include:-
Client Script Onchange of assignment group:-
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Populate Support group from Service Offering
g_form.setValue('watch_list','');
var assignmentGroup = new GlideAjax('getUsersWatchList'); //test is script include
assignmentGroup.addParam('sysparm_name', 'getWatchList');
assignmentGroup.addParam('sysparm_group', newValue);
assignmentGroup.getXML(setWatchList);
function setWatchList(response) {
var group = response.responseXML.documentElement.getAttribute('answer');
g_form.setValue('watch_list',group);
}
}
Script include Client Callable :-
var getUsersWatchList = Class.create();
getUsersWatchList.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getWatchList: function() {
var grArr = [];
var assignmentGroup = this.getParameter('sysparm_group');
var grpMembers = new GlideRecord("sys_user_grmember");
grpMembers.addQuery("group", assignmentGroup);
grpMembers.query();
while (grpMembers.next()) {
grArr.push(grpMembers.getValue('user'));
}
return grArr.toString();
},
type: 'getUsersWatchList'
});
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @edwardwong
Try below solution using after Business rule :
1. Set condition for Insert/Update & Assignment Group is not empty
2. Script :
