How to display last 3 months incident records using script

rajesh47
Kilo Contributor

How to display last 3 months incident records using script

7 REPLIES 7

background script

find_real_file.png

Regards,
Anshu

yes i know:) , i asked Rajesh where he wants to display the incident records?

what is the original requirement?

Tushar Ghuge
Tera Contributor

Hi @rajesh47 

Please try below script

 

var inc = new GlideRecord("incident");
inc.addEncodedQuery("sys_created_onONLast 3 months@javascript:gs.beginningOfLast3Months()@javascript:gs.endOfLast3Months()");
inc.orderByDesc("sys_created_on");
inc.query();
while(inc.next()){
gs.print(inc.number);
}