Background script to identify all empty CMDB tables

var gr = new GlideRecord('sys_db_object'); gr.addEncodedQuery('nameSTARTSWITHcmdb'); gr.query(); var count =0; while(gr.next()) { var cgr = new GlideAggregate(gr.name); cgr.addAggregate('COUNT'); cgr.query(); while(cgr.next()){ count = cgr.getAggregate('COUNT'); if(count == 0) gs.print('Name: ' + gr.name + ' Records: ' + count); } }

Comments

Popular posts from this blog

GlideRecord setValue

URL link in addInfoMessage

variable advanced reference qualifier example