How to schedule a report on between date range in servicenow.

Santhosh15
Tera Guru

Hello Experts,

 

Please see below screenshot, accordingly we need to scheduled the report on bi-weekly report.

 

Santhosh15_0-1684471447982.png

Can anyone help on this issue.

 

Thanks in Advance

@Ankur Bawiskar @JaspalSingh1122 @Chuck Tomasi @Palani Kumar 

12 REPLIES 12

@Santhosh15 

then you need to use condition field and check if the report should run or not

use GlideDateTime for calculation

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar 

 

Is there any script for calculating between those two dates ?

 

var gr = new GlideRecord('sys_report');
gr.addQuery('sys_id','2e19ad6887b22150e5cc96c73cbb3529');
gr.query();
if(gr.next())
{
var date1 = new GlideDateTime('2023-05-14');
        var date2 = new GlideDateTime('2023-05-28');
 
var query = "end_dateBETWEENjavascript:gs.dateGenerate('" + date1.getDate() + "','" + "00:00:00" + "')@javascript:gs.dateGenerate('" + date2.getDate() + "','" + "00:00:00" + "')";
 
gr.filter = query;
gr.update();
}

 

Thanks in Advance

@Ankur Bawiskar 

 

Can we add the above code in scheduled script 

 

thanks in advance

@Ankur Bawiskar ,

 

Please provide your inputs

 

Thanks in Advance

@Santhosh15 

you want report to run daily from Day 14 to Day 28 of the month?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader