- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2022 06:55 AM
Hi everyone,
whenever a person is tagged in the comments in workspace is it possible to add them as a watchlist automatically...?
In the attached screenshot @poornima batchu has been tagged in the comments. My requirement is when a person is tagged he/she automatically added as a watchlist. please provide a solution to achieve this.
thank you.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2022 09:08 AM
Hi there,
You can achieve your requirements with an after Insert business rule running on the live_notification table as below:
Script:
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var grTable = new GlideRecord(current.getValue('table'));
if (grTable.get(current.getValue('document'))) {
var recWatchList = grTable.getValue('watch_list');
if (current.getValue('field_name') == 'comments') {
if (recWatchList) {
if (recWatchList.indexOf(current.getValue('user')) == -1) {
var watchListArr = recWatchList.split(',');
watchListArr.push(current.getValue('user'));
grTable.setValue('watch_list', watchListArr.join());
grTable.update();
}
} else {
grTable.setValue('watch_list', current.getValue('user'));
grTable.update();
}
}
}
})(current, previous);
Result:
If this answer is helpful please mark correct and helpful!
Regards,
Christopher Perry
Regards,
Chris Perry

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2022 09:08 AM
Hi there,
You can achieve your requirements with an after Insert business rule running on the live_notification table as below:
Script:
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var grTable = new GlideRecord(current.getValue('table'));
if (grTable.get(current.getValue('document'))) {
var recWatchList = grTable.getValue('watch_list');
if (current.getValue('field_name') == 'comments') {
if (recWatchList) {
if (recWatchList.indexOf(current.getValue('user')) == -1) {
var watchListArr = recWatchList.split(',');
watchListArr.push(current.getValue('user'));
grTable.setValue('watch_list', watchListArr.join());
grTable.update();
}
} else {
grTable.setValue('watch_list', current.getValue('user'));
grTable.update();
}
}
}
})(current, previous);
Result:
If this answer is helpful please mark correct and helpful!
Regards,
Christopher Perry
Regards,
Chris Perry