Escalation before due date using business hours

  • 26 October 2007
  • 3 replies
  • 0 views

Badge +1

Hello everyone,


I am new to K2 and trying to implement a workflow... more specifically an escalation.


I am trying to get an escalation to fire 2 days before some due date.  This due date is entered into a form using a calendar.  I am trying the following, but it seems that my IF statement never equals true... can someone provide some insight at to what i am doing wrong?


Thanks in advance!


Sub Main(Byval K2 as EscalationRuleContext)
 Dim shipDate As Date
 Dim strDateTime As String
 strDateTime = SourceCode.K2Utilities.XMLFieldMod.GetXMLValue(K2.ProcessInstance.XmlFields("K2InfoPathSchema").Value,"my:myFields/my:Order_Tab/my:Order_Latest_Ship_Date")


 shipDate = Date.Parse(strDateTime)
 shipDate.AddDays(-1)
  
 If ( shipDate.CompareTo(System.DateTime.Today()) <= 1 )
   K2.SetEscalationRule( shipDate, 0, 0, 0, 0, 0 )
  Else
   K2.SetEscalationRule( system.DateTime.Now() )
  End If
 
 End Sub


3 replies

Badge +11

Haven't tested your code but from first glance it looks fine.


Do you know whether 'shipDate' is populated correctly?  Maybe add a couple of Console.Writeline statements and run K2Server in console mode to see what values are being set to what.


HTH,


Ockert

Badge +1

Thanks for the reply ockert, we seem to have it working after some trial and error..


We are now faced with another issue... Escalations.


I am trying to implement an escalation that will fire if a group of linked activities are not complete with 48 hours.  We are currently using a Spider workflow and oneof the branches is a sequence of activities which should not take more than 48 hours to complete.  Is there a way to create some type of global variable which is started when the group of activites begins, and gets reset when exiting the last activity of thew group?


Or, can you suggest another method to accomplish this?


Thanks again!


 

Badge +11

So, what you basically need is a process-wide escalation instead of an Activity Escalation.  I've heard of some similar implementations but unfortunately haven't got any specific detail on it.  Maybe your local Services office can point you in the right direction.


Regards,


Ockert

Reply