Adding a user to the watchlist automatically
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2023 05:30 AM
Hi All,
Whenever a hr case is created and assigned to a particular assignment group , a user needs to be added in the watchlist automatically . Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2023 05:52 AM
Hi @kali,
You use Before Business rule on insert and try below script
(function executeRule(current, previous /*null when async*/ ) {
var arr = [];
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group' ,current.getValue("assignment_group"));
gr.query();
while (gr.next()) {
arr.push(gr.getValue("sys_id")); //store sys_id of user's
}
current.u_assignment_group = arr;
gs.log('test u_assignment_group ' + current.u_assignment_group);
})(current, previous);
If my response helps you to resolve the issue close the question by Accepting solution and hit thumb icon. From Correct answers others will get benefited in future.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2023 07:14 AM
I would add to this, that you could think of creating an "HR Case Option" to trigger this functionality not for all HR Cases. You might not want to have it always executed.