- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2025 03:58 AM
How can we generate a notification for the manager of the 'Requested For' user when a Requested Item (RITM) for a specific catalog item has a start date between 5 to 6 days ago?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2025 04:05 AM
Hello @itsangeleye
Please find below code and let me know if that works for you
Schedule job:
var gr = new GlideRecord('sc_req_item');
gr.addQuery('cat_item', '620c2fb4c39b5a1004c43132b40131d1'); // replace your catalog item sys_id
gr.addQuery("variables.effe2774c35f5a1004c43132b4013141", "<=", gs.daysAgo(5)); //replace your start date variable sys_id
gr.query();
gs.info(gr.getRowCount());
while (gr.next()) {
gs.eventQueue('send.notification.demo', gr, gr.variables.manager, ''); // Event should be created
}
Thank you!
Thank You!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2025 03:59 AM
so what did you start with and where are you stuck?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2025 04:02 AM
Hi @itsangeleye
It’s better to use Flow Designer, which is low-code and no-code—more efficient and easier to maintain.
https://www.servicenow.com/community/developer-forum/send-email-2-months-before-due-date/m-p/1789333
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2025 04:03 AM
Hi @itsangeleye ,
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:
- 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.
- (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());
Use gs.eventQueue in the scheduled script to trigger the event. Then configure a notification to be sent when the event is triggered.
Thanks & Regards,
Badrinarayan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2025 04:05 AM
Hello @itsangeleye
Please find below code and let me know if that works for you
Schedule job:
var gr = new GlideRecord('sc_req_item');
gr.addQuery('cat_item', '620c2fb4c39b5a1004c43132b40131d1'); // replace your catalog item sys_id
gr.addQuery("variables.effe2774c35f5a1004c43132b4013141", "<=", gs.daysAgo(5)); //replace your start date variable sys_id
gr.query();
gs.info(gr.getRowCount());
while (gr.next()) {
gs.eventQueue('send.notification.demo', gr, gr.variables.manager, ''); // Event should be created
}
Thank you!
Thank You!