Event is not being triggered from the scheduled job

Sai Gopal
Tera Contributor

I am trying to fire a event from the scheduled jobs but it is not being fired.

SaiGopal_0-1703069301616.png

 

3 REPLIES 3

ersureshbe
Giga Sage
Giga Sage

Hi, I see the gs.eventQueue() does not follow the correct syntax. pls refer below link and resolve the syntax error.

https://developer.servicenow.com/dev.do#!/learn/learning-plans/tokyo/new_to_servicenow/app_store_lea...

 

Regards,
Suresh.

Saurav11
Kilo Patron
Kilo Patron

Hello,

 

Based on your use case and the table on which you have created the notification you will need to glide the record and get the record for which you want to trigger the notification and then use the glide object instead of the current.

 

So the code will be something like below:-

 

var gr= new GlideRecord('tablename');
gr.addQuery('addyourquery');
gr.query();
if(gr.next());
{
gs.eventQueue("notification.weekly",gr);
}

 

Please mark my answer as correct based on Impact. 

Sagar Pagar
Tera Patron

Hi @Sai Gopal,

 

Have you checked the Event logs [sysevent] table is there any record created for this event name?

 

If my response helps you resolve your issue. Kindly mark it as helpful & correct. It will be helpful to future readers! 👍🏻
Thanks,
Sagar Pagar

The world works with ServiceNow