Add scripting to conditions of report

Shane18
Kilo Expert

Hi,

I'm trying to add scripting to a report that I am creating, but I'm having some trouble and can't figure out how to do this. What I'm trying to achieve is the following: I want to show incidents that have not been updated within the last 24 hours. However, I do not want to include the weekends in this 24-hour count. I could do this by scripting - I just don't know how to add scripting to the conditions of a report.

Any help appreciated, thanks!

1 ACCEPTED SOLUTION

dvp
Mega Sage
Mega Sage

You can call a scriptinclude  in report condition

 

do the following

  1. create a client callable script include

 

function inci(id){
	
	
	var gr = new GlideRecord('core_company');
	gr.addQuery('u_services', 'IN', id);
	gr.query();
	
	var arr = [];
	
	while(gr.next()){
		
		arr.push(gr.sys_id.toString());
	}
	
	return arr;
	
}

 

2. Call the script in the report as shown in the below image

 

 

For your use case what you can do is return the incidents that fall under 24hr bucket and use the condition as sysID is one of

View solution in original post

10 REPLIES 10

Venkata Naga Su
Tera Contributor

Its not possible by OOB reporting , We have to PA indicators for this .

 

However we can create a schedule job to fill this data perioidcally in a custom table and you can report on that if you dont wanted to look into PA

That's a shame, but thanks for sharing. I don't believe performance analytics is being paid for on this instance. I may try your other method.

dvp
Mega Sage
Mega Sage

You can call a scriptinclude  in report condition

 

do the following

  1. create a client callable script include

 

function inci(id){
	
	
	var gr = new GlideRecord('core_company');
	gr.addQuery('u_services', 'IN', id);
	gr.query();
	
	var arr = [];
	
	while(gr.next()){
		
		arr.push(gr.sys_id.toString());
	}
	
	return arr;
	
}

 

2. Call the script in the report as shown in the below image

 

 

For your use case what you can do is return the incidents that fall under 24hr bucket and use the condition as sysID is one of

Thanks for your help. Marking this as the correct answer as it's the best answer I received. Thanks to Shaun too!