Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2022 04:34 AM - edited 10-17-2022 04:40 AM
I think you can just use gr.orderByAggregate('COUNT'); to achieve it.
getDuplicateAssetforAssignedTo: function() {
var str = [];
var gr = new GlideAggregate('cmdb_ci');
gr.addAggregate('COUNT', 'serial_Number');
gr.groupBy('serial_Number');
gr.addHaving('COUNT', '>', 1);
gr.orderByAggregate('COUNT');
gr.query();
while (gr.next()) {
str.push(gr.getValue('serial_Number') + '');
}
return str.toString();
},
});
Reference
Please mark this response as correct or helpful if it assisted you with your question.