script to print  incidents

shid077
Tera Contributor

Write a script to print  incidents created before 3 months without EncodedQuery.

2 REPLIES 2

Chaitanya ILCR
Kilo Patron

Hi @shid077 

use below script

var gr = new GlideRecord("incident");
gr.addQuery("sys_created_on",'<' , gs.beginningOfLast3Months());
gr.query();
while (gr.next()) {
	
  gs.info(gr.getValue('number')) 
}

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

Sohail Khilji
Kilo Patron
Kilo Patron

Hi @shid077 ,

 

 

Try this in background script :

 

var gr = new GlideRecord('incident');
gr.addQuery('sys_created_on', '<', gs.beginningOfLast3Months()); 
gr.query();
while (incidentGR.next()) {
    gs.info('Incident Number are :  ' + gr.number );
}

 

 

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect