How to count the number of records in a table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2025 03:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2025 03:52 AM
Hi
You can try this
var gr = new GlideRecord('incident');
gr.query();
gs.info(gr.getRowCount());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2025 04:08 AM
You can easily get answer to your question by doing a google search.
It will save a lot of time and effort.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2025 04:15 AM
There are many options to get the number of records in a table. You can use Glide Record with getRowCount() or use Glide Query with count(). You can also use addQuery or addEncodedQuery or where conditions to filter the data and get the count details.
As per community guidelines, you can accept more than one answer as accepted solution. If my response helped to answer your query, please mark it helpful & accept the solution.
Thanks,
Bhuvan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2025 04:25 AM - edited ‎09-30-2025 11:19 PM
hi Kishorchika.
My answe is totallin from within UI Builder.
Easiest way is to add an Aggregation Query data resource:
You can specify the table you are interested in:
and in the Output you will get the count
