Skip to content

Commit 7cfb10e

Browse files
Create DistrubuteEvents.js
1 parent 72f580e commit 7cfb10e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
(function executeRule(current, previous /*null when async*/ ) {
2+
3+
//define the queues array
4+
var event_queues = ['custom_queue_1', 'custom_queue_2','custom_queue_3','custom_queue_4']
5+
6+
//initialize glide record and do some filtering if necessary
7+
var grSomeContainer = new GlideRecord('container_table');
8+
grSomeContainer.addQuery('column', 'value'); //do some filtering if necessary
9+
grSomeContainer.query();
10+
11+
//for each one of the elements log an event with 5th parameter distributing it a specific queue from the array above
12+
while (grSomeContainer.next()) {
13+
gs.eventQueue('scope.event_name', grSomeContainer, null, null, event_queues[Math.floor(Math.random()*event_queues.length)]);
14+
}
15+
16+
})(current, previous);

0 commit comments

Comments
 (0)