- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2023 10:22 PM
I want to print assignment group : incident numbers......... like Hardware : INC000111,INC0000233
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2023 12:24 PM
@Avinash5410 Here is the script which can get you this data.
var glideIncident = new GlideAggregate('incident');
glideIncident.groupBy('assignment_group');
glideIncident.addAggregate('COUNT');
glideIncident.query();
while(glideIncident.next()){
var assignment_group ={'id':glideIncident.getValue('assignment_group'),'name':glideIncident.getDisplayValue('assignment_group')};
if(assignment_group.id!=''){
var glideIncidentRec = new GlideRecord('incident');
glideIncidentRec.addQuery('assignment_group',assignment_group.id);
glideIncidentRec.query();
var incidentNum ='';
while(glideIncidentRec.next()){
incidentNum = incidentNum+glideIncidentRec.getValue('number')+',';
}
gs.print(assignment_group.name+':'+incidentNum);
}
}
Here is the output.
Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2023 12:24 PM
@Avinash5410 Here is the script which can get you this data.
var glideIncident = new GlideAggregate('incident');
glideIncident.groupBy('assignment_group');
glideIncident.addAggregate('COUNT');
glideIncident.query();
while(glideIncident.next()){
var assignment_group ={'id':glideIncident.getValue('assignment_group'),'name':glideIncident.getDisplayValue('assignment_group')};
if(assignment_group.id!=''){
var glideIncidentRec = new GlideRecord('incident');
glideIncidentRec.addQuery('assignment_group',assignment_group.id);
glideIncidentRec.query();
var incidentNum ='';
while(glideIncidentRec.next()){
incidentNum = incidentNum+glideIncidentRec.getValue('number')+',';
}
gs.print(assignment_group.name+':'+incidentNum);
}
}
Here is the output.
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2023 06:31 PM
Could you pls explain line 6 what is id and name here.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2023 12:09 AM
@Avinash5410 Do you need any further help on this topic? Please mark my answer correct if you have no further questions on this topic.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2023 01:27 AM
in the script what is the importance of the line
var incidentNum = " "; if it is for spare between the numbers we can give while printing , if i try with out this its only printing the first incident , pls explain this line and its importance