Set up remainders for group approvals
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2023 12:00 AM
Hi All,
I have request to set up remainders for the group approvals for a catalog item for that I have created the Event, Notification but got stucked with the scheduled job script to trigger the event until the request got closed.
Could you please help me with this
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2023 12:33 AM
Hello @DSV22
var ci = new GlideRecord('table_namel');
ci.addEncodedQuery('query');
ci.query();
while(ci.next()){
gs.eventQueue('event.name', GlideRecord, parm1, parm2);
}
This is the reference of Schedule Job Script you can use.
Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2023 06:48 AM
Thanks Every one for your response I had tried with the script that you guys had provided Samaksh Wani, praneeth7, Amit Gujarathi.
And I apologize for the late response for your reply
Thanks again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2023 01:35 AM
You can write a script like this,
var gr = new GlideRecord('sc_req_item');
gr.addQuery('state','value of field choice');
gr.query();
while(gr.next()){
gs.eventQueue('event.name', current, parm1, parm2);
}
Make sure parm1 is enabled in notification.
Please mark my answer helpful if you find this useful
Thank you,
Praneeth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2023 04:11 AM
Hi @DSV22 ,
I trust you are doing great.
To set up reminders for group approvals on a catalog item in ServiceNow, we can create a scheduled job script. The script will query the 'sc_req_item' table to find items in a specific state, and then trigger an event to send notifications. Here's the script you can use:
// Set up reminders for group approvals on catalog items
// Query sc_req_item table to find items in a specific state (replace 'value of field choice' with the desired state value)
var gr = new GlideRecord('sc_req_item');
gr.addQuery('state', 'value of field choice');
gr.query();
// Loop through the result set and trigger the event for each matching item
while (gr.next()) {
// Replace 'event.name' with the actual event name you've created for notifications
gs.eventQueue('event.name', gr, parm1, parm2);
}
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi