How to add "timer/stopwatch" for Events.

Arjun Reddy Yer
Tera Guru

find_real_file.png

How Timer/Stopwatch can be added to the form so that when user open the ticket can able to see the remaining time for the ticket so that user can solve the ticket.

When User clicks on Publish button then Timer/Stopwatch needs to start.

Note: SLA's are not there can't configure

1 ACCEPTED SOLUTION

Hi,

Create a onDisplay BR on your table. and in the script add this code.

i assume Time left is a duration field. 

(function executeRule(current, previous /*null when async*/ ) {
    var gdt = new GlideDateTime(current.im_notification); //put right field name
    var gdt1 = new GlideDateTime(current.next_update_due); //put right field name
    var dur = new GlideDuration();
    dur = GlideDateTime.subtract(gdt, gdt1); //the difference between gdt1 and gdt2
    current.u_time_left.setValue(dur); //put right field name.
})(current, previous);

Mark the comment as a correct answer and also helpful if this helps to solve the problem.

View solution in original post

17 REPLIES 17

Severity 1&2: 45 mins

Severity 3: 2 hrs 45 mins

Severity 4: 11 hrs 45 mins

Severity 5: 23 hrs 45 mins

Timer needs to reset each time when it is published

process for add a check and based on severity

Time Left field should display timer in decreasing format not in fixed format

What do you mean decreasing format? Do you want it to be changing every sec on the form?

yes

find_real_file.png

it should be changed every sec on the form like if it's now 45:01 then for next sec it should display as 44:59