Adding users to watchlist on sc_task and inc table through task table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2023 12:53 AM
Hey folks,
I've been trying to add users to the watchlist on Inc and sc_task form based on the assignment group, but it either works on INC table or none. tried adding using task table but didn't seem to help. Tried a couple of ways through after business rule.
Any suggestion on how to got about?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2023 01:48 AM
Hi @Kishan_ ,
Hope you are doing great.
- Create an "After Business Rule" on both the Incident (INC) and Task (sc_task) tables.
- Implement the business rule script referencing below script:
(function executeRule(current, previous) {
if (current.assignment_group) {
var assignmentGroup = current.assignment_group;
var userGr = new GlideRecord('sys_user');
userGr.addQuery('assignment_group', assignmentGroup);
userGr.query();
while (userGr.next()) {
current.watch_list.add(userGr.getValue('sys_id'));
}
}
})(current, previous);
Regards,
Riya Verma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 08:08 AM
Hi Riya,
Sorry for the late reply.
It is working but I would like to have inly a specific set of users added to the watchlist. These users may or may not be part of the same assignment group.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2023 02:24 AM
please share your script and if you are using BR then share BR configuration screenshots as well.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 08:10 AM
Hi Ankur,
Will update the BR and try. Then will share the details.
Thanks