- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2015 04:53 PM
- 31,844 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2015 05:30 PM
Please note that the setLimit(1) will limit the query to only the first record returned by the query and the orderByDesc('sys_created_on') will sort the results based on its created date been the most recent one the first one in the list.
I hope this helps
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2015 07:02 AM
Thanks Berny! This is exactly what I was looking for.
-Neha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2015 08:40 AM
You're welcome!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2021 11:19 AM
How can I call this method from report condition builder?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2022 06:47 PM
Hi,
How to print my latest 10 incidents by written background script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2022 11:37 AM
Hi Hari,
See changes in bold below for your requirement:
var gr = new GlideRecord ('incident');
gr.orderByDesc('sys_created_on');
gr.setLimit(10);
gr.query();
while (gr.next()){
gs.print (gr.number + ' - ' + gr.sys_created_on);
}