- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 11:01 AM
Hi everyone,
I've trying to calculate the duration of tasks. I've got a simple business rule that does in fact update the duration but I noticed something that I would like some help understanding. even though it updates the field correctly with the value I've expected... when I try to call the field in a info message
it displays a different value. The mysterious 1970 default. So why is this value here? Where does it come from? Is my duration not actually set? I thought business rules actually changed the data not just your form view. Am I doing something wrong?
I've posted my code below.
I've seen lots of forums about 1970s popping up when people try and and work with dates but not too many great explanations. I've gathered that it's probably an issue with trying to display a string thinking it's a date/time or something like that but obviously if I was sure I wouldn't be asking.
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 04:57 PM
Hi David,
The duration is stored in a DateTime field, which mean it is stored as a number of seconds since 1970-01-01 and when asking for the value it is returning a date.
What you can do to display this in a message with the right format is to use the displayValue, for example:
gs.addInfoMessage(current.business_duration.getDisplayValue())
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 04:57 PM
Hi David,
The duration is stored in a DateTime field, which mean it is stored as a number of seconds since 1970-01-01 and when asking for the value it is returning a date.
What you can do to display this in a message with the right format is to use the displayValue, for example:
gs.addInfoMessage(current.business_duration.getDisplayValue())
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2016 05:39 AM
Well now I feel silly. I've been using .getDisplayValue() in all my testing scripts but forgot to add it here. Although I'm still glad I asked because I did not realize that duration was actually stored as seconds since 1970-01-01 and that is a good bit of information. Thank you for the response.