Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2023 08:36 AM - edited 05-24-2023 08:43 AM
Hello,
I have a script that shows a widget based on the duration a ticket has been open, it's priority and some other factors. Currently, when a new ticket is logged, the widget should not show, however when going through the script debugger, 120:00:00 always evaluates to true, despite the ticket ages being minutes old, could someone explain this?
I have previous methods before this that execute properly, such as 04:00:00, 24:00:00 and 72:00:00.
OpenTimeMS is calculated by:
// Get length of time ticket has been open in days, hours, minutes, seconds
var diff2 = GlideDateTime.subtract(new GlideDateTime(gr.sys_created_on), new GlideDateTime());
var timeOpenMS = diff2.getDurationValue();
// Incidents open for 5 days or longer, escalation is 0, priority is 1, 2, 3 or 4
// State is new or work in progress, escalation 0, priority is 1, 2, 3 or 4
if (timeOpenMS > "120:00:00" && data.table == 'incident' && gr.active == true && gr.priority == 1 || gr.priority == 2 || gr.priority == 3 || gr.priority == 4 && gr.incident_state == 1 || gr.incident_state == 2 && gr.escalation == 0 && gr.company == 'ad0459981b7c0c100375ca217e4bcbb0' && (gr.caller_id == gs.getUserID() || gs.hasRole("admin"))) {
data.showWidget = true;
data.showEscalate = true;
vEscalate = 0;
}
Thanks!
Solved! Go to Solution.