Glide record

soniya patil
Tera Contributor

How to print 5 active incident tickets

6 REPLIES 6

Harish Bainsla
Tera Sage
Tera Sage
var gr = new GlideRecord('incident');
gr.addQuery('active','true');
gr.orderByDesc('sys_created_on');
gr.setLimit(5);
gr.query();
while(gr.next())
{
gs.log("The active records" + gr.number);}
HarishBainsla_0-1703141456086.png

 

swathisarang98
Giga Sage
Giga Sage

Hi @soniya patil ,

 

Please find the below code to print 5 active records.

 

 

 

var gr=GlideRecord('incident');//Gliding to incident Table
gr.addQuery('active',true);//querying for active records
gr.setLimit(5);//Setting the output limit to 5
gr.query();//Querying
while(gr.next())
{
    gs.print('The active incident number is ' + gr.number);// print the active incident
}

 

 

Please check and Mark Helpful and Correct if it really helps you.

Regards,

Swathi Sarang