Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

script to print  incidents

shid077
Tera Contributor

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

2 REPLIES 2

Chaitanya ILCR
Giga 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

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