How get incidents list if they created in last week in email notifications
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2022 04:10 AM
I need a script for get last week created incidents list in email notifications
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2022 04:15 AM
Hi,
should be simple enough if you know how to use filter conditions and GlideRecord
1) visit incident table
2) apply the filter -> Created on Last Week
3) Copy the query
4) Use that in encodedQuery
var gr = new GlideRecord("incident");
gr.addEncodedQuery("sys_created_onONLast week@javascript:gs.beginningOfLastWeek()@javascript:gs.endOfLastWeek()");
gr.query();
while(gr.next()){
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2022 07:45 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2022 11:47 PM
Hello Ankur,
Can you please tell me how can i get the incidents created in past 3 days for the same?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2022 04:18 AM
Hello,
No script is required, follow below steps
1) Create simple Report which will give list of incidents created last week
2) Create scheduled report entry and refer report created in step 1 here, and configure rest
This way it is easier to get and this automation will run by default without any adjustment
Mark my answer as correct if that helps
Regards
Regards,
Musab