gs.eventQueueScheduled method in Scheduled job
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2020 03:08 AM
I have created a job which must trigger everyday at 10am. Notification needs to be triggered in exact 24 hours after approval triggered and if the approval is still in requested state. But unfortunately gs.eventQueueScheduled is not working . Every time the job runs, it sends all the approvals which are in requested state. The value stored in gdt is correct as i checked in log. So email must trigger in the date and time stored in gdt.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2020 03:13 AM
Hello,
First create a event and process that one with below sysmtax
Use the gs.eventQueue('eventname',object(generally table name),'parm1','parm2');
Refer below,
http://wiki.servicenow.com/index.php?title=Event_Registry#gsc.tab=0
http://wiki.servicenow.com/index.php?title=Events_and_Email_Notification#gsc.tab=0
Thanks,
Pratiksha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2020 03:14 AM
Hi,
please use this; no need for comparing date etc
while(gr.next()){
var gdt = new GlideDateTime(gr.sys_created_on);
gdt.addDaysUTC(1);
gs.eventQueueScheduled('approval.reminder', gr, '', '', gdt);
}
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader