Skip to content

Commit 55657c4

Browse files
Create Business rule to call an event
1 parent 29778e8 commit 55657c4

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+
(function executeRule(current, previous /*null when async*/) {
2+
3+
// Assuming you are getting the list of added users from the watchlist
4+
var addedUsers = current.<list field name>.split(',');
5+
6+
// Loop through the added users to trigger the event for each
7+
addedUsers.forEach(function(userID) {
8+
// Get the user record to retrieve first name
9+
var userGr = new GlideRecord('sys_user');
10+
if (userGr.get(userID)) {
11+
12+
// Fire an event for each user with their first name
13+
gs.eventQueue('<event name>’, current, userID, userGr.first_name);
14+
}
15+
});
16+
17+
})(current, previous);

0 commit comments

Comments
 (0)