The CreatorCon Call for Content is officially open! Get started here.

How to Use gs.eventqueue?

servicenow lath
Tera Contributor

Through inbound email actions iam Creating a New Case form, if the mail domain is from gmail, case should not be created and a notification should be sent to the Sender's mail how to do this?

 i have used gs.event queue but the notificantion is not sending

current.u_insp_email = email.from;
var domain = email.from.split('@')[1];
gs.info("Name is: " + domain);

if(domain=='gmail.com')

{

current.setAbortAction(true);
gs.eventQueue('sn_customerservice.Found', current , email.from.toString());

}

case is not creating , but the eventqueue is not working 

how to do that?

4 REPLIES 4

Ishaan Shoor
Mega Sage
Mega Sage

Hi @servicenow lath 

1) Checkout this video by Chuck for a tuturial of gs.eventQueue() - https://www.youtube.com/watch?v=jXkGt4iJsnY

2) Also, find developer documentation here for the same - https://developer.servicenow.com/dev.do#!/learn/learning-plans/quebec/new_to_servicenow/app_store_le... 

.

 

Hope this helps!
BR.
Ishaan Shoor

There are two ways to generate events:

  • Server-side script
  • Workflow Create Event activity

Server-side Script

The eventQueue() and eventQueueScheduled() methods are part of the GlideSystem server-side API. Use the eventQueue() and eventQueueScheduled() methods to generate events in server-side scripts.

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('x_60157_employee_spe.employeeOccasion',current,current.number,gs.getUserName());

 

Hope this helps!
BR.
Ishaan Shoor

Gunjan Kiratkar
Kilo Patron
Kilo Patron

Hi @servicenow lath ,

Please refer below threads as well:-

https://www.servicenow.com/community/developer-forum/eventqueue-not-triggering-from-inbound-action/m... 

 

https://www.servicenow.com/community/it-service-management-forum/use-event-and-inbound-action-to-sen... 


Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

Without using GS.eventqueu how can we send notification.

due to certain conditions the case record is not created by inbound actions,

and i need the notification to be send to the user "case is not created"