ITSM

SomyaG
Tera Contributor

Hello,

script to get the list of incident number according to all category .

 Can anyone help?

 

Thanks in advance

1 REPLY 1

Vishal Jaswal
Giga Sage

Hello @SomyaG 

var incidentGR = new GlideAggregate('incident');
incidentGR.addNotNullQuery('category');
incidentGR.groupBy('category');
incidentGR.query();
while (incidentGR.next()) {
   var category = incidentGR.getValue('category');
   gs.print('Category: ' + category + '\n');
   var incGR = new GlideRecord('incident');
   incGR.addQuery('category', category);
   incGR.query();
   while (incGR.next()) {
       gs.print('  - ' + incGR.getValue('number'));
   }
}

 

VishalJaswal_0-1745330675874.png

VishalJaswal_1-1745330763151.png

 


Hope that helps!