
tiagomacul
Mega Sage
Options
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 06-12-2020 01:20 PM
Get last updated Date record using GlideAggregate
var aggIncident = new GlideAggregate('incident');
aggIncident.addAggregate('MAX', 'sys_created_on');
aggIncident.groupBy('priority');
aggIncident.query();
while(aggIncident.next()){
//get the first record, this should be the latest
dtLastUpdate = aggIncident.getAggregate('MAX','sys_created_on');
gs.log('number=' +aggIncident.number + ' pri ' + aggIncident.priority + ' dtLastUpdate ' + dtLastUpdate);
}
Sample results
*** Script: number= pri 1 dtLastUpdate 2020-01-20 12:32:05
*** Script: number= pri 2 dtLastUpdate 2020-01-20 12:31:29
*** Script: number= pri 3 dtLastUpdate 2020-02-13 13:49:40
*** Script: number= pri 4 dtLastUpdate 2020-01-20 12:30:40
*** Script: number= pri 5 dtLastUpdate 2020-06-10 19:16:17
Labels:
- 3,230 Views
Comments
Priyanka22Yadav
Mega Guru
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
01-23-2023
10:50 PM
Why the number is not getting displayed.