Scheduled job to queue event

josh_brostoff
Giga Contributor

I have a scheduled job I want to use to queue an event which then sends an email notification.   What is wrong here?

Screen Shot 2016-12-06 at 6.28.51 PM.png

Screen Shot 2016-12-06 at 6.30.29 PM.png

4 REPLIES 4

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Josh,



The syntax of eventqueue is gs.eventQueue("incident.commented", current, gs.getUserID(), gs.getUserName());


Please make sure you are passing all the parameters. More info can be found here.


http://wiki.servicenow.com/index.php?title=Events_and_Email_Notification#gsc.tab=0


Hi Pradeep,



I just want to this notification to send every 6 months to all authors of published articles.   It looks like the methods in the parameters you listed only pull current users.   Is there a way I can have this email notification send to all authors of published articles?



Thanks,



Josh


levin
ServiceNow Employee
ServiceNow Employee

Hi Josh,



You may try the following the steps to troubleshoot:



1. run the script and trigger similar script in some business rule


2. make sure the event of "knowledge.review.recycle" is created in /sysevent_list.do


this will isolate if the script is functional to the user


3. if yes, monitor if the state of this event is marked as "Processed"


this will isolate if the event has been processed by event processor or not


4. if yes, monitor the record of email is created in Outbox /sys_email_list.do?sysparm_query=mailbox%3Doutbox%5Esys_created_onONToday%40javascript%3Ags.daysAgoStart(0)%40javascript%3Ags.daysAgoEnd(0)


this will isolate if the email notification is defined correctly



Regards,


Levin


Tadz
Tera Guru
Tera Guru

Hi Josh,



I think you need to populate all the parameters of gs.eventqueue.


If you have already configured the recipients in the email notification.


You can try this:



var gr = new GlideRecord('sc_req_item');


            gr.setLimit(1);


        gr.query();


      if(gr.next()){


    gs.eventQueue("event.name", gr , gr.number , gr.cat_item);


      }