Scheduled event execution in servicenow

Naveen Velagapu
Mega Guru

hi All,

I am thinking a scenario , where i want to process particular events to be processed at particular time and other in different time

ex: lets say all the events created in incident should be processed when at 3 to 4 and all the events created in change should be btw 5-6 ...

i.e, event should be created and it should be processed later, is there any way for that ???

i tried few options , they are not useful..

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

Hi Naveen,



Yes, there is a way to do this. You can use gs.eventQueueScheduled() to trigger an event at a specific time. It looks like this:



var dt = new GlideDateTime();


gs.eventQueueScheduled("incident.event.at_2", current, "", "", dt);



No reference found.


View solution in original post

12 REPLIES 12

Chuck Tomasi
Tera Patron

Hi Naveen,



Yes, there is a way to do this. You can use gs.eventQueueScheduled() to trigger an event at a specific time. It looks like this:



var dt = new GlideDateTime();


gs.eventQueueScheduled("incident.event.at_2", current, "", "", dt);



No reference found.


hi Chuck ,


this Method is useful thanks,



Can we do like this , i will create all the events with queue name as "test", and can i process all those events with queue name "test" with a scheduled job ??


Hi Naveen,



You don't need a scheduled job if they are triggered to go off at a certain time. Events trigger either notifications or script actions. If you set up the GlideDateTime variable, that's the time when it will trigger. No scheduled job needed. The following example will trigger all the notifications that respond to 'incident.nightly' at 2AM (assuming it was triggered from a business rule where current is the current incident.)



var dt = new GlideDateTime('2016-07-24 02:00:00');


gs.eventQueueScheduled('incident.nightly', current, gs.getUserID(), gs.getUserName(), dt);



Hope that helps.


Hi Chuck,


My thought process is to build a table similar to sysevent , so that i can include particular events in that table   and handle whenever required.



Something independent to existing process.