- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2022 02:23 PM
Hi PA Community,
I am trying to build a report for "Days since last P1 Incident" for my organizaton. I've attempted to use a Function Field within Reporting however datediff operations have to have some limitiations and I can't think of a way to have Performance Analytics do it.
Anyone have any tips or experience building a similar report?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2022 03:51 PM
For a quick solution,I would probably just create a new dynamic content block
instanceName.service-now.com/content_block_programmatic_list.do?sysparm_query=&sysparm_view=
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate>
var result = 0;
var inc = new GlideRecord('incident');
inc.addQuery('priority', '1');
inc.orderByDesc('opened_at');
inc.setLimit(1);
inc.query();
if(inc.next()) {
var start = new GlideDateTime(inc.opened_at);
var now = new GlideDateTime();
var diff = GlideDateTime.subtract(start, now);
var days = diff.getRoundedDayPart();
result = days;
}
</g:evaluate>
<p><span style="font-size: 36pt; color: #ff0000;"> ${result}</span></p>
</j:jelly>
Longer term solution, look into seeing what's possible through PA.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2022 03:51 PM
For a quick solution,I would probably just create a new dynamic content block
instanceName.service-now.com/content_block_programmatic_list.do?sysparm_query=&sysparm_view=
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate>
var result = 0;
var inc = new GlideRecord('incident');
inc.addQuery('priority', '1');
inc.orderByDesc('opened_at');
inc.setLimit(1);
inc.query();
if(inc.next()) {
var start = new GlideDateTime(inc.opened_at);
var now = new GlideDateTime();
var diff = GlideDateTime.subtract(start, now);
var days = diff.getRoundedDayPart();
result = days;
}
</g:evaluate>
<p><span style="font-size: 36pt; color: #ff0000;"> ${result}</span></p>
</j:jelly>
Longer term solution, look into seeing what's possible through PA.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2022 04:06 PM
Thank you @Mike_R you are fantastic and this community is lucky to have a contributor like you! Appreciate the help once again!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2022 02:40 PM
I think you can create a formula indicator to do that and then show it using a score wizard.
Solution by Adam may give you a hint
Please mark this response as correct or helpful if it assisted you with your question.