How to Create a Dynamic Monthly Scheduled Incident Report 21st Previous Month to 20th Current Month

pr8172510
Tera Guru

Hi Community,

I am working on a requirement to create a dynamic monthly scheduled report for Incidents.

Requirement:

  • The report should include incidents created from the 21st of the previous month till the 20th of the current month.
  • Example:
    • Report generated on 21st May → should fetch incidents from 21st April to 20th May.
    • Report generated on 21st June → should fetch incidents from 21st May to 20th June.
  • The report should run automatically every month and send the report through email.

    Current challenge:

    • I am unable to configure an exact dynamic filter for:
      • Previous month 21st
      • Current month 20th
2 REPLIES 2

RitheshB
Tera Contributor

Hi,

You can achieve this requirement using a scripted date range instead of standard relative filters because ServiceNow relative conditions cannot directly handle a custom cycle like 21st previous month → 20th current month dynamically.

Recommended approach:

Use a Scheduled Script / Scripted Report and calculate the dates dynamically using GlideDateTime.

Example:

var start = new GlideDateTime();
start.addMonthsUTC(-1);
start.setDayOfMonthUTC(21);
start.setDisplayValue(start.getDate() + " 00:00:00");

var end = new GlideDateTime();
end.setDayOfMonthUTC(20);
end.setDisplayValue(end.getDate() + " 23:59:59");

Then query incidents using:

gr.addQuery('sys_created_on', '>=', start);
gr.addQuery('sys_created_on', '<=', end);

This will dynamically work every month:

  • 21 Apr -> 20 May

  • 21 May -> 20 Jun

  • etc.

You can schedule this script monthly and send the generated report through email automatically.

Thanks.

Tanushree Maiti
Mega Patron

Hi @pr8172510 

 

Try with this:

 

  1. Create the Report and Dynamic Filter

 

  • Navigate to Reports > Create New
  • Set the Source type to Table and select Incident [incident]. 
  • Set the Type (e.g., List or Bar Chart).
  • In the Condition builder, apply the following Created date filters:
    • Created  on or after  Last month  21
    • AND Created  on or before  This month  20 
  • Click Save to store the report

 

  1. Configure Monthly Schedule
  • In the report header, click Share and select Schedule
  • Fill out the scheduling details:
    • Run: Select Monthly.
    • Day: Select 21.
    • Time: Select the exact time you want the report to be emailed. 
  • Under the Email tab, add the users or groups receiving the report. 
  • Set the Subject (e.g., "Incident : Monthly Report: 21st to 20th") and select the format (e.g., PDF). 
  • Click Submit or Save
Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: