- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2025 04:31 AM
Hello Community,
I have a requirement to show only top 10 oldest incidents on the report.
the report should limit only to 10.
Please assist.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2025 05:36 AM
Hi @Jithender123
There's no direct approach to acheive this on the basic reporting.
However, you can using scripting to achieve this. PFB sample.
1. Script Include: Client callable
var getOldIncidents = Class.create();
getOldIncidents.prototype = {
initialize: function() {},
getIncs: function() {
var arr = '';
var incidentGR = new GlideRecord('incident');
incidentGR.addActiveQuery(); // optional: to get only active incidents
incidentGR.orderBy('sys_created_on'); // order by creation date
incidentGR.setLimit(10); // limit to 10 records
incidentGR.query();
while (incidentGR.next()) {
arr += incidentGR.sys_id + ',';
}
return arr;
},
type: 'getOldIncidents'
};
2. Report: Call script include form the report filter.
javascript:new getOldIncidents().getIncs();
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2025 05:36 AM
Hi @Jithender123
There's no direct approach to acheive this on the basic reporting.
However, you can using scripting to achieve this. PFB sample.
1. Script Include: Client callable
var getOldIncidents = Class.create();
getOldIncidents.prototype = {
initialize: function() {},
getIncs: function() {
var arr = '';
var incidentGR = new GlideRecord('incident');
incidentGR.addActiveQuery(); // optional: to get only active incidents
incidentGR.orderBy('sys_created_on'); // order by creation date
incidentGR.setLimit(10); // limit to 10 records
incidentGR.query();
while (incidentGR.next()) {
arr += incidentGR.sys_id + ',';
}
return arr;
},
type: 'getOldIncidents'
};
2. Report: Call script include form the report filter.
javascript:new getOldIncidents().getIncs();
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2025 05:47 AM
you can check the approach shared by @J Siva which has scripting involved
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