- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2019 02:09 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2019 02:14 PM
Hi Amit
U r going to this link
https://community.servicenow.com/community?id=community_blog&sys_id=19ace225dbd0dbc01dcaf3231f961948
Thanks,
Rahul Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2019 02:20 PM
Hi ,
Do you need it for specific tables or all of the tables ?
1) if all the tables, then you have to query the sys_db_object (where all the tables are stored) to get the table names.
2) For each table name , query the glide record and get the desired row count by using getRowCount()
var gr = new GlideRecord('sys_db_object');
gr.query();
while (gr.next()){
var grTable = new GlideRecord(gr.name);
grTable.query();
grTable.getRowCount();
gs.addInfoMessage("Table "+gr.label+ " has these many rows: "+grTable.getRowCount());
}
This query would take a lot of time since it is querying all the tables. If you want specific tables then you can assign the conditions in the filter section. gr.AddQuery(?,?)
Let me know how it goes.
Please mark this answer as correct/helpful if this solves your problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2019 02:31 PM
hi
count all table row not particular table

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2019 02:35 PM
Yeah so if you want to count table row then use grTable.getRowCount(); . Is that not what you want ? Can you explain your requirements with an example ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2019 03:34 PM
like
incident table,problem table,change table etc.
count all row in incident,problem,etc