Create Trend Definitions?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2022 07:48 AM
Is it possible to create new trend definitions to use in reports that use the trend condition in the filter? I can't find the table that would store these trend definitions. In this case, create a trend on 1/2 hour increment.
Thanks!
- Labels:
-
Reporting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2022 06:11 AM
Yeah, we'll see. It works perfect on background script, but adding the function as a filter condition that calls the script include shows a warning in the log that appears to be a known error. So, I have a case open with HI to see when the fix is.
I tried your idea on the dynamic filter option. Unfortunately the dynamic filter option doesn't work on date/time fields 😕
Returning this warning: https://community.servicenow.com/community?id=community_question&sys_id=980a56841babfc10aefc11751a4bcbf9
And the KB on this is missing: https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0996113
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2022 08:13 PM
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0749822
try this one!
PaulSylo
Kindly mark "helpful", if this helps, or Mark as "Accepted " if it solves your issues !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2022 06:45 AM
Ah, cool find
Calls two script include functions:
getHalfHourINC: function() {
var getTask, gdt, gt, gt1, timeFormatHH, timeFormatMM, timeFormatSS;
var arr = [];
getTask = new GlideRecord('incident');
getTask.addEncodedQuery("opened_atONLast 12 months@javascript:gs.beginningOfLast12Months()@javascript:gs.endOfLast12Months()^opened_atDATEPART5 pm hour@javascript:gs.datePart('hour','17','GE')^ORopened_atDATEPART6 pm hour@javascript:gs.datePart('hour','18','LE')");
getTask.query();
while (getTask.next()) {
gdt = new GlideDateTime(getTask.opened_at);
gt = gdt.getLocalTime();
timeFormatHH = gt.getByFormat('HH');
timeFormatMM = gt.getByFormat('mm');
timeFormatSS = gt.getByFormat('ss');
if ((timeFormatHH == 17 && timeFormatMM >= 30) || (timeFormatHH == 18 && timeFormatMM == 0)) {
arr.push(getTask.sys_id.toString());
}
}
return arr;
},
getHalfHourRITM: function() {
var getTask, gdt, gt, gt1, timeFormatHH, timeFormatMM, timeFormatSS;
var arr = [];
getTask = new GlideRecord('sc_req_item');
getTask.addEncodedQuery("opened_atONLast 12 months@javascript:gs.beginningOfLast12Months()@javascript:gs.endOfLast12Months()^opened_atDATEPART5 pm hour@javascript:gs.datePart('hour','17','GE')^ORopened_atDATEPART6 pm hour@javascript:gs.datePart('hour','18','LE')");
getTask.query();
while (getTask.next()) {
gdt = new GlideDateTime(getTask.opened_at);
gt = gdt.getLocalTime();
timeFormatHH = gt.getByFormat('HH');
timeFormatMM = gt.getByFormat('mm');
timeFormatSS = gt.getByFormat('ss');
if ((timeFormatHH == 17 && timeFormatMM >= 30) || (timeFormatHH == 18 && timeFormatMM == 0)) {
arr.push(getTask.sys_id.toString());
}
}
return arr;
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2022 07:48 AM
Wow so cool!
PaulSylo
Kindly mark "helpful", if this helps, or Mark as "Accepted " if it solves your issues !