Set Escalation Date failed

  • 23 February 2006
  • 5 replies
  • 0 views

Badge +7
Hi all,

I get an error using K2.SetEscalationRule(DateTime) method...

Assuming I have a DateTime (StartEscDate) which is 6 hours after Now, if I use
K2.SetEscalationRule(StartEscDate), it fails saying that the escalation date is smaller than the start date. It can't be possible since I checked it using :


if (DateTime.Now < StartEscDate)
{
K2.SetEscalationRule(StartEscDate);
}
else
{
K2.SetEscalationRule(DateTime.Now.AddMinutes(1));
}



But it works if I use K2.SetEscalationRule(StartEscDate,0,0,0,0,0)...

Does anyone know what is the difference and why
K2.SetEscalationRule(DateTime) method fails ?

5 replies

Badge +4
Have you had a look at the server time? Try writing out the date to the console first. I had trouble in the past with date formats. I first convert the dates then it worked. I do not trust DateTime.Now()

Write out the dates to display in the console to make sure that it is the dates you expect:

DateTime DateTime = new DateTime(2006,3,24,0,0,0);

Console.WriteLine(DateTime);
Console.WriteLine(DateTime.Now);

Badge +7
thanks for reply but I already tested it... but you put doubt in my mind and I will recheck it...

Jsut to be sure, can anyone confirm that K2.SetEscalationRule(StartEscDate,0,0,0,0,0) and K2.SetEscalationRule(StartEscDate) do the same thing?
Badge +4
The SetEscalationRule sets the Escalation to fire any number of days, minutes and seconds after a specific date and time past in as the first parameter.



public void SetEscalationRule(
DateTime date,
int Days,
int Hours,
int Minutes,
int Seconds,
int Repeats
);


Look at the OR in the following example:

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



You are using the C# Overload method witch should make no difference:

[C#]


public void SetEscalationRule(
DateTime date
);

SetEscalationRule(DateTime) Method
//Or
SetEscalationRule(DateTime,0,0,0,0) Method
// Is the same



Hope this helps.
Badge +7
Ok thanks, so I think you should look at your code guys because in my case,

SetEscalationRule(DateTime.Now.AddMinutes(2)) Method fails

whereas

SetEscalationRule(DateTime.Now.AddMinutes(2),0,0,0,0) Method success

So what happened ??
Badge +4
Hi, I will test this and give you feedback. If I find the same problem, I will let Labs know about immediately. Thanks. :D

Reply