- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2016 05:13 AM
how i get the count of incidents which are created last month not in last 30 days with out specifying any date using background script, without using any report types I dont want want to specify any date any month. suppose i am checking using background script in december the count will display the no. of incidents for the month of november .... how can i do it??
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2016 06:12 AM
Please try
var ga = new GlideAggregate('incident');
ga.addQuery('opened_atONLast month@javascript:gs.beginningOfLastMonth()@javascript:gs.endOfLastMonth()');
ga.addAggregate('COUNT');
ga.query();
var incidents_opened = ga.next() ? ga.getAggregate('COUNT') : 0;
gs.info(incidents_opened);
Please feel free to connect, follow, mark helpful / answer, like, endorse.
John Chun, PhD PMP ![]() | ![]() |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2016 12:18 PM
Please try
// get the month name of the previous month
var monthNames = ',December,January,February,March,April,May,June,July,August,September,October,November'.split(',');
gs.info(monthNames[new GlideDate().getMonthLocalTime()]);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2016 08:15 PM
Thanks a lot, John.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 11:29 PM
How can i display last 3moths incident records using script