
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2020 04:20 AM
Hi All,
When executing the below script, It shows me the count which is different from the count shown in list view with exact same query string! (Going to list view, and applying group by on Manager field).
I have already checked there are no Query Business Rules active on that table.
var myManagerList = [];
var getResourceManagers = new GlideAggregate('sys_user');
getResourceManagers.addEncodedQuery('active=true^company=c7af548d37323100d4e8daa543990e36^managerISNOTEMPTY');
getResourceManagers.addAggregate('COUNT','manager');
getResourceManagers.groupBy('manager');
getResourceManagers.query();
while (getResourceManagers.next())
{
var manager = getResourceManagers.getAggregate('COUNT', 'manager');
myManagerList.push(manager);
}
gs.info('myManager length == '+myManagerList.length); //Output: 3757, List View Count: 3703
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2021 05:55 AM
Hi All, Thanks for your help.
The real issue was - "When on a list and performing a 'Group By' action on a column, the row count that appears in the pagination may not match with how many rows are appearing on the page."
More information here - https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0720019
Thanks, Sumit

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2020 03:15 AM
Just imagining if the array has some pre-stored value like the cache and needs to be flushed and recalculated for this task? Is it used elsewhere?
My question may be weird, but may point some clue.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2020 02:06 AM
Yes, the array length is more than grouped by number of manager records.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2020 03:45 AM
Hi
In your script, do you have several groups with only whitedpaces in it?
E.g. one group with one blank and another one with two blanks, etc?
Maybe that results in the different outcome.
Let me know.
BR
Dirk

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2020 10:59 AM
Hi
Do you have any update on that?
Did you try out to investigate on my idea about this issue?
Just let me know, please.
BR
Dirk

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2021 05:55 AM
Hi All, Thanks for your help.
The real issue was - "When on a list and performing a 'Group By' action on a column, the row count that appears in the pagination may not match with how many rows are appearing on the page."
More information here - https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0720019
Thanks, Sumit