Skip to main content
Hi all,

I created activity that will give escalation email notification but not using "Escalate After" or "Escalate On" as I see in Template

I need to escalate Document that has Expired Date value base on 22 hours BEFORE Expired Date

With K2 Studio I did hard coded :

dtExpiredDate = DateTime.Parse(K2.ProcessInstance.DataFields("ExpiredTime").Value)

dtEscalation = dtExpiredDate.AddHours(-22)

K2.SetEscalationRule(dtEscalation)

For instance Now is 4/3/2006 12:00:00 AM
ExpiredTime = 4/4/2006 12:00:00 AM
So dtEscalation should be 4/3/2006 2:00:00 AM

Error Message :
" An escalation date can not be smaller than the startdate "

I guess validation rule for Escalation base on Date Not Time,
give advise please...

Regards
Widodo
Here is a good example:

[Visual Basic]

Public Function MyFunction(ByVal K2 As KO.EscalationRuleContext) As Boolean
Dim myK2ActivityInstance As KO.ActivityInstance
Dim myK2ProcessInstance As KO.ProcessInstance
Dim myK2StringTable As KO.StringTable
Dim DateTime As DateTime = "6/19/2003 12:00:00 AM"
Dim Days As Integer = 1
Dim Hours As Integer = 0
Dim Minutes As Integer = 0
Dim Seconds As Integer = 0

'Set the Escalation
K2.SetEscalationRule(Days, Hours, Minutes, Seconds, 0)
'OR
K2.SetEscalationRule(DateTime, Days, Hours, Minutes, Seconds, 0)
'OR
K2.SetEscalationRule(DateTime)
End Function

When you set SetEscalationRule , you must just always make sure that the escalation date is bigger that today.

I cannot see the business logic why you want to do it otherwise.

Hope this helps.

David

Reply