Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This background script allows ServiceNow administrators and developers to quickly check the number of active records across multiple tables such as Incident, Change Request, Problem, or Task.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Script: Check Number of Active Records per Table
// Author: Bhavya
// Use: To count active records in multiple tables

(function() {
// List of tables you want to check
var tables = ['incident', 'change_request', 'problem', 'task'];

gs.print('Active Record Count per Table');

for (var i = 0; i < tables.length; i++) {
var tableName = tables[i];
var gr = new GlideRecord(tableName);

// Filter for active records
gr.addQuery('active', true);
gr.query();

var count = gr.getRowCount();
gs.print(tableName + " - Active Records: " + count);
}
})();
Loading