- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2024 06:21 AM
Hi All,
Can anyone please help us on the below requirement.
We have a Record producer with set of of variables.
One of the variable option is YES , then we need to populate one specific group members on watch list field level.
Advance thanks.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2024 09:15 AM
@LaraReddy Instead of putting the hard coded sys_ids of users, you can query the sys_user_grmemeber table inside the record producer script and populate the watchlist as follows.
if(producer.<variable_name>=='YES'){ //Replace <variable_name> with the name of the variable you wish to check
var groupMember = new GlideRecord('sys_user_grmember');
groupMember.addQuery('group','c38f00f4530360100999ddeeff7b1298'); //Replace with the sys_id of your group
groupMember.query();
var grMemberArray = [];
while(groupMember.next()){
grMemberArray.push(groupMember.getValue('user'));
}
current.watch_list = grMemberArray.toString();
}
Please mark the answer helpful and correct if this addresses your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2024 09:49 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2024 06:43 AM
@LaraReddy In the record producer script field you can check the following.
if(producer.<variable_name>=='YES'){ //Replace <variable_name> with the name of the variable you wish to check
current.watch_list = '9087a72283b90a10442951b8beaccccddd'; //sys_id of the member
}
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2024 08:31 AM
Hi Sandeep,
Thanks for the response.
On the group level, we have more than five users are available, do we need to pass all the user's sys_id or is there any alternate approach to add the group users to the watch list field.
And also in future, If any new user added to the same group again we need to add the added user's sys_id on script level ???
Advance thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2024 09:15 AM
@LaraReddy Instead of putting the hard coded sys_ids of users, you can query the sys_user_grmemeber table inside the record producer script and populate the watchlist as follows.
if(producer.<variable_name>=='YES'){ //Replace <variable_name> with the name of the variable you wish to check
var groupMember = new GlideRecord('sys_user_grmember');
groupMember.addQuery('group','c38f00f4530360100999ddeeff7b1298'); //Replace with the sys_id of your group
groupMember.query();
var grMemberArray = [];
while(groupMember.next()){
grMemberArray.push(groupMember.getValue('user'));
}
current.watch_list = grMemberArray.toString();
}
Please mark the answer helpful and correct if this addresses your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2024 09:49 AM