Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

gs.eventqueue

elizabeth keen
Tera Contributor

what is gs.eventqueue in servicenow. 

1 ACCEPTED SOLUTION

shubham jagtap
Tera Guru

Generating Events

There are two ways to generate events:

  • Server-side script using the gs.eventQueue() method
  • Workflow Create Event activity

gs.eventQueue() Method

The eventQueue() method is part of the GlideSystem server-side API. The eventQueue() method inserts an event in an event queue. The eventQueue() method is typically passed four parameters but can also take an optional 5th parameter:

  1. Event name. Enclose the event name in quotes.
  2. GlideRecord object, typically current but can be any GlideRecord object from the event's table.
  3. Any value that resolves to a string. This is known as parm1 (Parameter 1). Can be a string, variable that resolves to a string, or method that resolves to a string.
  4. Any value that resolves to a string. This is known as parm2 (Parameter 2). Can be a string, variable that resolves to a string, or method that resolves to a string.
  5. (Optional) Name of the queue to manage the event.

example:

gs.eventQueue('event.name', GlideRecord, parm1, parm2); // standard form

gs.eventQueue('x_58872_needit.overdueNeedItTask',current,current.number,gs.getUserName());

you can refer below links:

https://developer.servicenow.com/app.do#!/lp/new_to_servicenow/app_store_learnv2_automatingapps_madr...

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

https://community.servicenow.com/community?id=community_question&sys_id=674f7e69db58dbc01dcaf3231f96...

after going throw this mark it as correct/helpfull.

Thank you

 

View solution in original post

5 REPLIES 5

ChitruY
Tera Contributor

gs.eventqueue is a method that is used to trigger an event and gs.eventqueue is used in a server side script.

gs.eventqueue('event name', GlideObject, Parm1,Parm2);


Event name. Enclose the event name in quotes.
GlideRecord object, typically current but can be any GlideRecord object from the event's table.
Any value that resolves to a string. This is known as parm1 (Parameter 1). Can be a string, variable that resolves to a string, or method that resolves to a string.
Any value that resolves to a string. This is known as parm2 (Parameter 2). Can be a string, variable that resolves to a string, or method that resolves to a string.