Skip to content

Commit dc9cbbd

Browse files
authored
Create Add Users in Watchlist to CC
Use this script to add a user in watchlist in any tables that extended from Task table
1 parent f236c21 commit dc9cbbd

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Use this script to add a user in watchlist in any tables that extended from Task table
2+
3+
if (!current.watch_list.nil()) {
4+
var watcherIds = current.watch_list.split(',');
5+
for (var i = 0; i < watcherIds.length; i++) {
6+
var user = new GlideRecord("sys_user");
7+
user.addQuery("sys_id", watcherIds[i]);
8+
user.addQuery("notification", 2);
9+
user.addQuery("email", "!=", "");
10+
user.query();
11+
if (user.next()) {
12+
email.addAddress('cc', user.email.toString());
13+
} else {
14+
email.addAddress('cc', watcherIds[i]);
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)