The CreatorCon Call for Content is officially open! Get started here.

getValue not working for GlideAggregate

caffry
Kilo Guru

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

1 ACCEPTED SOLUTION

Harika Bhupathi
Giga Guru

Hi @caffry 

 

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

View solution in original post

10 REPLIES 10

Harika Bhupathi
Giga Guru

Hi @caffry 

 

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