Business Duration vs. Duration

John Vo1
Tera Guru

Can someone please explain what these 2 attributes are actually tracking and where these numbers are being generated from?   I have attached a screen shot.

Thanks,

John

22 REPLIES 22

Can you elaborate?   Are you saying you were able to get the duration as an integer in seconds from the GlideDuration object?


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);


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


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.


tanumoy
Tera Guru

The values are calculated from the business rules: mark_resolved and mark_closed