Calculate duration for "Days Open"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2013 08:59 AM
Hello, I have created a duration field called "Days Open" which I would like to have reflect the total amount of time (in Days) elapsed between between the Opened date and Current date.
I know this has got to be very simple to do so I was looking at the "Duration" field to use as an example, but I haven't been able to find where the code is entered for the calculation. ??
Thanks in advance for any help you can provide. 🙂
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-31-2013 08:51 AM
Thanks for your help, Geoff. I really appreciate it. I am not a developer so pardon me, but I do see where you've got the "end" in the calculation set to the "Work End" field. How can I replace the current.work_end value with the instance current date and time? I basically just need to see the length of time an active incident/task has been open.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2014 09:09 AM
Generally work_end does get set to the current time when the task closes or whatever. But if you need to you can set it:
current.work_end = gs.nowDateTime();
Of course you'll only want to do this once. So you should probably have some kind of changesTo() condition on your business rule, or test the work_end before setting it:
if (current.work_end.toString() == '') {
current.work_end = gs.nowDateTime();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2014 04:29 AM
Hello,
Thanks for the script, but it doesn't work for me. What kind of a field is u_task_duration?
Is the client script a business rule client callable? Sorry for the question, but I am trying to figure out, why it doesn't work.