give me the real time scenarios for eventQueue and eventQueueScheduled ?

Rajesh98
ServiceNow Employee
ServiceNow Employee

give me the real time scenarios for eventQueue and eventQueueScheduled ?

7 REPLIES 7

Varsha Jadhav1
Giga Expert

Hi Rajesh

Go trough below link, you will get 

 real time scenarios for eventQueue and eventQueueScheduled 

https://community.servicenow.com/community?id=community_question&sys_id=85dd8f6ddb9cdbc01dcaf3231f96...

 

Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.

DirkRedeker
Mega Sage

Hi Rajesh

My answer in short words. 

With eventQueue, you will write events to the system event log. There is a field indicating, WHEN the event scheduler should process the event EARLIEST.

For eventQueue function, this is always Now. 

With the eventQueueScheduled function, you can set a date and time, so that you intend the event to be processed later at your given time. 

That may be cool, if you intend to fire the event right now, but you want your processs to happen during the night, for example.

Does that make sense to you? 

Let me know if that answered your question and mark my answer as correct and helpful, please. 

BR 

Dirk 

Sanket Khabiya
Kilo Sage

*** eventQueue(String name, Object instance, String parm1, String parm2, String queue)
-> Queues an event for the event manager.

Example :

if (current.operation() != 'insert' && current.comments.changes()) {
gs.eventQueue('incident.commented', current, gs.getUserID(), gs.getUserName());
}

*** eventQueueScheduled(String name, Object instance, String parm1, String parm2, Object expiration)
-> Queues an event for the event manager at a specified date and time.

Parameter(s):
Name        Type      Description
name        String     Name of the event being queued.
instance    Object     A GlideRecord object, such as "current".
parm1       String     (Optional) Saved with the instance if specified.
parm2       String     (Optional) Saved with the instance if specified.
expiration  Object    Date and time to process this event.

 

Regards,

Sanket