Time Worked Field... no auto counter, just a field to enter time upon closure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2011 03:15 PM
So... my managers want that "Time worked" field to appear for certain groups when they close their incidents, and they want it to be mandatory.
However, they don't want it automatically counting. They just want a mandatory field to appear when they put the incident state to "Resolved."
I can accomplish that with a UI policy that only shows the field when the incident state is closed or resolved, and only if the group starts with ERP (the group in question).
Problem is, if I do that, a timer field appears and starts counting up. I just want them to type in the amount of time they feel they worked on the issue.
Is this possible? More easily done with a numerical text input field?
Let me know, thanks!
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2012 03:44 PM
Perhaps I'm not as perceptive as I believe I am, but I'm not seeing where in that code it starts out paused.
I put in a client script with that code, and the timer is just going as soon as it's shown. Not paused as it is when I don't have this client script enabled.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2012 04:28 PM
That's because the script is a toggle. If you've already got it paused via the property then the script will start it again. There's a section to that code that resets the timer to zero though. That's the piece you'll need if you're using the property to pause by default.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2012 04:35 PM
So, I'm assuming I just comment out the toggle parts, and keep the reset part, like this:
function onLoad() {
toggleTimer('time_worked','00:00:00');
}
function toggleTimer(fieldName,timerVal){
//Get the necessary timer elements for fieldName given
var timerEl = $('element.' + g_form.tableName + '.' + fieldName);
if (timerEl != null){ //Make sure script does not break if field not present
var timerPause = timerEl.select('input[id*=paused]')[0];
var timerImg = timerEl.select('img[src*=images/timer_]')[0];
//Reset the timer to timerVal given
if(timerVal){
g_form.setValue(fieldName,timerVal);
}
}
}
Instead of the full code? And will it reset it to 00 every time the incident is viewed? Or just until they put something in it?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2012 05:35 PM
No, you really just need to do this...
g_form.setValue('time_worked','00:00:00');