Trigger an event using background script.

PriyaRaj
Tera Contributor

Hi,

I am having one requirement to build a notification to notify a group when the record is inserted in 'quarantine_file'. To test this notification, I need to create an event and then trigger the notification with the event. 

But I haven't worked on event before. So kindly help me to trigger the event through background script so that I could test the notification as we cannot directly create a record in 'quarantile_file'.

Thanks in Advance!!

6 REPLIES 6

ArunavaS
Tera Contributor

You can use the following code to call an event in server side script

gs.eventQueue(<event name>, current , param 1, param 2);

Sri Harsha2
Tera Expert

Hi @PriyaRaj,

1. Create event in the "Event Registry'.

2. In the background script write below code to trigger the event

var  grTask = new GlideRecord('task');  //glide into your table

grTask.addQuey('___'); // add your condition 

grTask.query();

while(grTask.next()) { //if any record found then send notification 

gs.eventQueue('Event_name',grTask,parm1,parm2); // trigger event using eventQueue() method

}