Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Record count in database view

fkameka
Kilo Contributor

How to create a record count in database view? I can't do this with core reports.

The record should include these fields

Header 1Header 2Header 3Header 4Header 5
QuestionDatePersonResult= yesResult= No
2 REPLIES 2

Liju John1
Mega Guru

// getCount : function(){



var queryString = 'state=1'


var gr = new GlideAggregate('incident_db_view'); //GlideAggregate query


gr.addAggregate('count');


gr.orderByAggregate('count');



gr.addEncodedQuery(queryString);


//gr.groupBy('priority');



gr.query();


var incidentCount;


while(gr.next()){


  incidentCount = gr.getAggregate('count');


}


gs.log(incidentCount);



//return incidentCount;


// }


https://community.servicenow.com/community?id=community_question&sys_id=192517551b3d78540b8a9979b04bcbd0

can you help me with this question?