How to start or pause the Timer field based on the other field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2018 09:09 PM
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)
Thanks
- Labels:
-
Best Practices
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2018 10:27 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2018 10:35 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2018 10:53 PM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2018 12:28 AM
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
}