How to start or pause the Timer field based on the other field

Rameshnathan
Tera Expert

Hi,

I have timer field on my incident table but by default is running whenever i'm open the new form,

but i want to Stop the timer field by default and it should run based on the other field (Ex : state field)

find_real_file.png

Thanks

9 REPLIES 9

Gowrisankar Sat
Tera Guru

Hi,



If you dont want to run the timer on load of a task inherited/incident table,



Screen Shot 2018-01-12 at 11.48.39 AM.pngScreen Shot 2018-01-12 at 11.48.16 AM.png


Time worked fields


Hi


Thanks you, now i can able to stop the timer by default,



Please guide me how to start the timer when state is changed to In progress condition



Thanks


This link should help you, but make sure the code supports the servicenow version you are using:



How to start or pause or stop a timer field through a script?


Hi



By onChange client script we have   can stop or start the timer field



function onChange(control, oldValue, newValue, isLoading, isTemplate) {


if (isLoading || newValue === '') {


return;


}


//alert(g_form.getValue('u_timer'));


var button = document.getElementById("link.incident.u_timer").parentElement;


if (button != null) {


button.click();


}


//Type appropriate comment here, and begin script below


}