ServiceNow GlideAggregate: count number of Azure tables in the cmdb meeting a certain criteria

 

var gaAzure = new GlideAggregate('cmdb_ci'); var sQuery = 'sys_class_nameLIKEazure^operational_status=1^sys_updated_on<javascript:gs.beginningOfLast9Months()^discovery_source=NULL^ORdiscovery_source=Unknown'; gaAzure.addEncodedQuery(sQuery); gaAzure.addAggregate('COUNT', 'sys_class_name'); gaAzure.query(); var dupls=[]; dupls.push("tables:"); while (gaAzure.next()) { var tableLine=gaAzure.getAggregate("COUNT", "sys_class_name") + " => " + gaAzure.getElement("sys_class_name") + "\n"; dupls.push(tableLine); } gs.print(dupls);

 

(ServiceNow )

Comments

Popular posts from this blog

GlideRecord setValue

URL link in addInfoMessage