Business Duration vs. Duration
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2016 04:59 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2016 08:38 AM
Can you elaborate? Are you saying you were able to get the duration as an integer in seconds from the GlideDuration object?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2016 09:32 AM
FYI, I used the below hack to populate business_stc correctly for now.
var schedule = new GlideSchedule('<ID of Business Day Schedule>');
var duration = schedule.duration(current.opened_at.getGlideObject(), current.closed_at.getGlideObject());
current.business_duration = duration.getDurationValue();
current.business_stc = gs.dateDiff('1970-01-01 00:00:00', duration, true);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2016 12:07 AM
Hi,
Sorry for the delay in replying, i used the below;
var std = '26-08-2016 05:00:00'; //current.sys_updated_on.getDisplayValue();
var end = '26-08-2016 08:00:00'; // mi.start.getDisplayValue();
var ac = new DurationCalculator();
ac.setSchedule('be693d670ffa020035c6d24172050eb8');
ac.setTimeZone("London/Europe");
var dura = ac.calcScheduleDuration(std, end);
this gives the duration in seconds, however the business duration field expects milliseconds, so
var eldura = dura * 1000;
and then i can update the business_duration
mi.business_duration.setDateNumericValue(eldura);
Hope this helps
Regards
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2016 04:46 AM
Thanks, I had forgotten about the DurationCalculator. It basically does the same thing I did, but it might be more clear. I can make some definite improvements on what I wrote though.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2016 05:10 AM
The values are calculated from the business rules: mark_resolved and mark_closed