Skip to main content

Set ExpectedDuration based on DueDate when ProcessInstance starts


TimeSpan timespan = (DateTime.Now - DueDate);
K2.ProcessInstance.ExpectedDuration = Math.Abs(timespan.TotalMinutes);


Update:  After it's set, the expected duration remained 0 in the ViewFlow 4.6.6 for the Process but the number is there in ProcInst table.


Calculation DueDate based on duration from StartDate


System.TimeSpan duration = new System.TimeSpan(0, 0, K2.ProcessInstance.ExpectedDuration, 0);


DueDate = StartDate.Add(duration);


or


SELECT startdate, DATEADD(minute, expectedDuration, startDate) DueDate
  FROM MK2Server].]Server].]ProcInst]


 

Does this fuction take Working Hours into calculation?


It doesn't make use of work hours (we don't use this feature).  

It's based on real dates - when does the task need to complete by?     (not when can it be done by if you have a 2 work-day week)


Reply