File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change
1
+ A business rule to trigger an event on a notification when someone is added to a list. It also parses a user's first name.
2
+
3
+ (function executeRule(current, previous /*null when async*/) {
4
+
5
+ // Assuming you are getting the list of added users from the watchlist
6
+ var addedUsers = current.<list field name>.split(',');
7
+
8
+ // Loop through the added users to trigger the event for each
9
+ addedUsers.forEach(function(userID) {
10
+ // Get the user record to retrieve first name
11
+ var userGr = new GlideRecord('sys_user');
12
+ if (userGr.get(userID)) {
13
+
14
+ // Fire an event for each user with their first name
15
+ gs.eventQueue('<event name>’, current, userID, userGr.first_name);
16
+ }
17
+ });
18
+
19
+ })(current, previous);
You can’t perform that action at this time.
0 commit comments