Need help in the scripting to display the array values while using GlideAggregate
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2022 12:14 AM
Hi,
We are using Glide Aggregate and trying to display the values of the incident number in an array as output but we are not able to display the values. If you use GlideRecord we are able to display the value and the below script is working for GlideRecord but not for Glide Aggregate. Can anyone please help us with the issue.
var score='';
var scoreJson=[];
var scanApp = new GlideAggregate('incident'); // if we use Glide Record below script is working
scanApp.addEncodedQuery("state!=7^short_description!=NULL");
scanApp.groupBy('sys_created_by');
scanApp.orderByDesc('sys_created_on');
scanApp.getRowCount();
scanApp.query();
gs.info(scanApp.getRowCount());
while(scanApp.next()){
score=scanApp.getDisplayValue("number");
scoreJson.push(score.toString());
}
gs.info(scoreJson);
Output - while using Glide Aggregate -
Output while using Glide Record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2022 12:58 AM
Hi,
As suggested by Vaibhav, update the groupBy to number field or comment the below lines
scanApp.groupBy('sys_created_by');
scanApp.orderByDesc('sys_created_on');
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2022 01:05 AM
Hi Sagar,
I want to group them by sys_created_user as each user may create multiple incidents. So I want to get only the latest incident created by each user.
Thanks,
Revathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2022 01:10 AM