- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2025 12:19 AM
Hi Members,
Skip invalid GroupBy condition: ORDERBYundefined
*** Script: NEHA COUNT of Incidents 187
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2025 12:37 AM
Hi @NehaSNOW ,
try this
var gaCount = new GlideAggregate('incident');
gaCount.addAggregate('COUNT');
gaCount.groupBy('state');
gaCount.query();
while (gaCount.next()) {
gs.info("NEHA COUNT of Incidents " + gaCount.state.getDisplayValue() + ' ' + gaCount.getAggregate('COUNT'));
}
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2025 12:37 AM
Hi @NehaSNOW ,
try this
var gaCount = new GlideAggregate('incident');
gaCount.addAggregate('COUNT');
gaCount.groupBy('state');
gaCount.query();
while (gaCount.next()) {
gs.info("NEHA COUNT of Incidents " + gaCount.state.getDisplayValue() + ' ' + gaCount.getAggregate('COUNT'));
}
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2025 12:44 AM
your syntax and script for GlideAggregate is wrong.
Use script shared by @Chaitanya ILCR
More details here
If my response helped please mark it correct and close the thread so that it benefits future readers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2025 01:00 AM
Hi @NehaSNOW
Can you please try the below please :-
var x= new GlideAggregate('incident');
x.addAggregate('COUNT');
x.groupBy('state');
x.query();
while (x.next()) {
gs.info("NEHA COUNT of Incidents in State " + x.getValue('state') + " : " + x.getAggregate('COUNT'));
}
Output :-
*** Script: NEHA COUNT of Incidents in State 1 : 45
*** Script: NEHA COUNT of Incidents in State 2 : 32
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2025 01:27 AM - edited 03-13-2025 12:45 AM