Using GlideAggregate group by Month

hloredo
Kilo Explorer

Hello, I'm trying to get a list of created and close incidents by month using the GlideAggregate object. The same you'd get creating a trend report.

I've tried to set a trend and then an aggregate:

var trend = new GlideAggregate('incident');
trend.setTrend ('opened_at','Month');
trend.addAggregate('COUNT');
trend.query();

so far, it seems that the setTrend method does nothing as I'm getting just one record with the count of all the incidents.

How the setTrend method must be used? Couldn't find any example in the wiki. How can I access the Month value from the query results?

Thanks in advance

6 REPLIES 6

Hi Kshitij Tripathi and Abhiram Diddigi,



Maybe this website helps you:



Talk:GlideAggregate - ServiceNow Wiki



Regards,


Rodrigo Higa


what is 'timeref'  ?