Get the total number of incidents opened over last 6 months excluding weekends.

deepthireddy
Kilo Expert

Hi everyone,

Just one small help and I'm not sure of the right approach.

I want to pull out the total number of incidents opened in the last 6 months without including weekends i.e. Saturday and Sunday. Current filter conditions do not show this option. Anybody tried this and can help me out?

Thanks a ton,

Deepthi

5 REPLIES 5

Shishir Srivast
Mega Sage

we can something like this,



var gr = new GlideRecord('incident');


gr.addQuery('sys_created_on', '>=' , 'javascript:gs.daysAgo(180)');


gr.query();


while(gr.next()){


var dt = new GlideDateTime(gr.sys_created_on);


var dow = dt.getDayOfWeek();


if(dow!=6 && dow!=7){


gs.print(gr.number);


}


}


Deepak Ingale1
Mega Sage

Hi Deepthi,



You can do it via simple filter conditions without any script


find_real_file.png


Deepak,


Awesome ! this helps


You can further simplify this query:



Screen Shot 2018-01-29 at 2.17.54 PM.png