Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2023 05:59 AM - edited 05-25-2023 05:59 AM
Fixed with the following example, it seems that by retrieved time somehow reverted back to D HH:MM:SS format but now works as expected:
// 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();
// Runs when a ticket is viewed from the service protal > my tickets > incident
gs.info("The duration of this ticket is: " + diff2.getDurationValue()); //syslog_list.do
Example conditions:
// Set escalation widget to false by default
if (timeOpenMS < "04:00:00" && data.table == 'incident' && gr.active == true && gr.escalation == 0 && gr.company == 'ad0459981b7c0c100375ca217e4bcbb0' &&
(gr.caller_id == gs.getUserID() || gs.hasRole("admin"))) {
data.showWidget = false;
data.showEscalate = false;
} if (timeOpenMS > "5 00: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;
}