- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2021 06:47 AM
unable to get the Value of short description using GlideAggregate
var agg = new GlideAggregate('incident');
agg.addAggregate('COUNT', 'category');
agg.orderBy('assigned_to');
agg.orderBy('state');
agg.addQuery('sys_created_on', '>=', 'javascript:gs.beginningOfLast12Months()');
agg.query();
while (agg.next()) {
gs.print(agg.getValue("short_description"));
}
Note: i doesnt want to use GlideRecord .
Is it possible to get the value of a field using GlideAggregate
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2021 08:41 AM
Hi
Try out this
var agg = new GlideAggregate('incident');
agg.addAggregate('MAX', 'reopen_count');
agg.orderByDesc('short_description');
agg.orderBy('state');
agg.addQuery('sys_created_on', '>=', 'javascript:gs.beginningOfLast12Months()'); agg.query();
if(agg.next()) {
gs.print(agg.getValue("short_description"));
}
Regards,
Harika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2021 07:13 AM
I've never tried to pull field values like that with GlideAggregate but it may be possible.
You could try with something like:
gs.print(agg.short_description);
Or define it as a var, then call the var:
var getDesc = agg.short_description;
gs.print(getDesc);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2021 07:58 AM
Hi Ian,
Even i have tried the approach which u said still no luck..
its returning empty value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2021 08:36 AM
Wasn't sure if it would work either, but thought it worth a shot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2021 07:15 AM
Hi,
you can only get the value of the field which is used for aggregation i.e. category in your example
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader