- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2022 07:33 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2022 08:44 PM
Hi Lavanya,
Can you explain more about your question? Whether you neded to get the records in flow or business rule?
Thank you
Harihara Sudhan M S

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2022 08:44 PM
Hi Lavanya,
Can you explain more about your question? Whether you neded to get the records in flow or business rule?
Thank you
Harihara Sudhan M S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2022 08:50 PM
Hi,
something like this
var gr = new GlideRecord("incident");
gr.orderByDesc('sys_created_on');
gr.setLimit(10);
gr.query();
while(gr.next()) {
gs.info(gr.number);
}
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
03-28-2022 09:59 PM
Hello
If you are supposed to be doing this in server side script: kindly follow
var grTab= new GlideRecord("<table name>");//here it will be incident
grTab.orderByDesc("sys_created_on");
grTab.addActiveQuery();//if you need 10 records which are in new/on hold/in progress/resolved state.
//if you need random first 10 records then remove above line of script
grTab.setLimit(10);//you need 10 so we have added 10 here, change accordingly.
grTab.query();
while(grTab.next())
{
gs.addInfoMessage(grTab.Number);//you will get the numbers displayed
}
kindly refer Docs for additional info
Mark my Response as Correct or Helpful, if you find it Appropriate.
Gaurav Shirsat : ServiceNow Community MVP 2022
https://www.linkedin.com/in/gauravshirsat/