i want to get first 10 incidents list
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi All,
How can i retrieve the top 10 incident records from the incident table using JS/Glide Record?
For Example, i want to retrieve the 10 most recently created incidents.
Could someone please provide an example script.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago - last edited an hour ago
try this
setLimit(): Sets the limit for how many records you want to fetch.
var c=0;
var check= new GlideRecord('incident');
check.addQuery('category','software');
check.setLimit(10);
check.query();
while(check.next())
{
c++
gs.print('check the :'+check.number);
}
gs.print('total nnumber of record is:'+c);
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
******************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12m ago
@Swathi504893573 Here is the script.
var gr = new GlideRecord('incident');
gr.orderByDesc('sys_created_on');
gr.setLimit(10);
gr.query();
while (gr.next()) {
gs.info(gr.number); //Print incident number
}
