How to count no of incidents opened before 10th of each month for this current year in…
- User
How to count no of incidents opened before 10th of each month for this current year in servicenow
- Assistant
How to count no of incidents opened before 10th of each month for this current year in servicenow
To count the number of incidents opened before the 10th of each month in ServiceNow for the current year, you'll need to use a combination of filters and potentially scripts or scheduled reports if you're trying to automate this. Here’s a step-by-step guide on how to do this within the ServiceNow platform:
Navigate to the Incident Table:
incident.list in the filter navigator and pressing Enter.Create a Filter:
Set Conditions:
Opened:
Opened On is on or after 1/1/this year (replace "this year" with the current year).Opened On is before dayofyear@10 for each month.Unfortunately, ServiceNow’s filter does not allow for this condition directly by month, so you would typically create separate filters for each month or go into a scripting solution.
Visualizing Results:
If you'd like to automate this process with a more advanced technique, you'll have to write a script in a Scheduled Script Execution or a scheduled report. This is assuming you have the appropriate permissions to create such scripts.
Create a Scheduled Script Execution:
Script Example:
var grInc = new GlideRecord('incident');
grInc.addEncodedQuery('opened_at>=javascript:gs.beginningOfThisYear()^opened_at<javascript:gs.endOfThisYear()^DAYOFMONTH(opened_at)<=10');
grInc.query();
var count = 0;
while (grInc.next()) {
count++;
}
gs.info('Number of incidents opened before the 10th of each month this year: ' + count);
Schedule the Script:
Review the Output:
gs.info can be reviewed in the application logs.Create a New Report:
Configure Report:
Opened On.Schedule the Report:
Each of these methods has its use cases depending on your access level and needs, so choose the one that best fits how often you need this data and how in-depth your filtering needs to be.
Not yet included in a published release.