Announcing the Global SNUG Board of Directors. Learn more here
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
Why the number is not getting displayed.