PRINT INCIDENT CATEGORY HARDWARE & SOFTWARE WITH TOTAL COUNT IN GLIDERECORD
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2022 07:28 PM
PLEASE HELP ME WITH THE BKOW SCRIPT TO GET THE TOTAL OF OF HARWARE AND SOFTWARE WITH LIST
var gr = new GlideRecord('incident');
gr.addQuery('category', 'software');
gr.addQuery('category', 'Hardware');
gr.query();
while(gr.next()){
OUTPUT NEEDED:
TOTAL NUMBER OF INCIDENT WITH HARDWARE CATEGORY IS - 10
TOTAL NUMBER OF INCIDENT WITH SOFTWARE CATEGORY IS - 12
Total number of incident is - 100
total number of incident with hardware and software is - 22
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2022 04:31 AM
Hi Arvind.
pls try this
var gr= new GlideRecord('incident');
gr.addEncodedQuery('categoryINsoftware,hardware');
gr.query();
var ak=gr.getRowCount();
gs.print("total count hardware and software category ::"+ak);
while(gr.next())
{
gs.print(gr.category +"=>"+ gr.number);
}
output:
Please mark as correct answer if this solves your issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 03:28 PM
Hi Aravind,
Try below:
var enc = 'active=true^category=hardware^ORcategory=Software'; // conditions
var activeIncident = new GlideRecord ('incident');//query the table
activeIncident.addEncodedQuery(enc);
activeIncident.query();
var gr = activeIncident.getRowCount();
gs.print("total number of incident: "+gr);
while(activeIncident.next()){
{
gs.print(activeIncident.category +":"+ activeIncident.number);
}
}