Discrepancy Between GlideRecord.getRowCount() and Actual Table Count in cmdb_sam_sw_install
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2025 12:01 AM
Hi Everyone,
I'm encountering a discrepancy between the number of records retrieved using a background script and the actual count shown in the cmdb_sam_sw_install table UI.
Here’s the script I’m running:
var installGR = new GlideRecord('cmdb_sam_sw_install');
installGR.query();
gs.info('Matching Software Installs Count: ' + installGR.getRowCount());
This script outputs:
Script: Matching Software Installs Count: - 427991
However, when I check the same table in the UI (with all filters cleared), the total number of records displayed is 410,910.
I’d like to understand:
- Why is getRowCount() returning more records than what I see in the table UI?
- Could this be due to ACLs, replication lag, or some other issue?
- What’s the best way to ensure the script returns a count that matches what users see in the UI?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2025 12:10 AM
It was effected by ACL. if you need to get results same as UI, you should use GildeQuery
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2025 12:16 AM
GlideRecord won't consider ACL.
Check any Table level READ ACL or Query business rule is restricting records.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2025 08:12 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2025 12:23 AM
You can use GlideRecordSecure which enforce ACLs. Most probably there can be query BR which is restricting the records.