Ageing Report

Biji
Tera Contributor

Hi,

I am trying create a ageing report for the following scenario:

Suppose a case has been created on 1st Jan and assigned to the assignment group XYZ. Then the case got transferred to the another group ABC on 5th Jan. Again on 10th the case got re-transferred to XYZ and case got closed on 15th.

The ageing of the case on assignment group is 10 days.

I have to show a report where cases are grouped by aged days: 0-2 days,2-5 days,5-10 days,>10 days

How can I create the report? could you please help on this

2 REPLIES 2

Rob Sestito
Mega Sage

I am not 100% on if this is needed or not, but a while back we needed something to show aging of cases as well - from creation to close.

We built a scheduled job to calculate the aging of our cases - with the use of a 'aging category' filed. That way, we could throw that field into a report to show the aging category of a case.

Here is what we have: (u_aging_category is the custom field)

find_real_file.png

u_updateAgingCategoryField();

function u_updateAgingCategoryField() {
	var elapsedTime = 0;
	var openedMs=0;
	var currMs=0;
	var aging = '';
	var queryString ='active=true';
	var gr = new GlideRecord('sn_hr_core_case');
	gr.addEncodedQuery('u_aging_category!=>28^ORu_aging_category=');
	gr.addQuery('active',true);
	gr.query();
	while(gr.next()) {
		openedMs= new GlideDateTime(gr.opened_at).getNumericValue();
		currMs=new GlideDateTime().getNumericValue();
		elapsedTime = (currMs-openedMs)/86400000;
		
		//check to see when the item was created
		if (elapsedTime <= 2) aging = '0-2';
			if (elapsedTime > 2) aging = '3-7';
			if (elapsedTime > 7) aging = '8-14';
			if (elapsedTime > 14) aging = '15-21';
			if (elapsedTime > 21) aging = '22-28';
			if (elapsedTime > 28) aging = '>28';
			
		gr.setWorkflow(false); //skip any Business Rules
		gr.autoSysFields(false); //do not update system fields
		gr.u_aging_category = aging;
		gr.update();
	}
}

The timing in how you use this job is really up to you.

Now, if I were to look at a quick list view of MY cases (just to make it easier to see), we have the Aging Category field as a column to see.

find_real_file.png

Here is shows that my cases have aged greater than 28 days. Obviously, if you want to show higher than this, then you can adjust the script as you see fit (or shrink it down).

So, if I do a quick list view report on active cases, I can put my Aging field in to see. And you will notice, some of these cases are blank, due to just being created today:

find_real_file.png

Again, not sure if this is what you are looking for - just thought I would share what we had.

Thanks,

-Rob

 

Uncle Rob
Kilo Patron

Report Ranges could probably help you out.  Then just group your data by created date.

https://docs.servicenow.com/bundle/orlando-performance-analytics-and-reporting/page/use/reporting/co...