Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

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

Not applicable

// 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?