Conditional Escalations

  • 19 April 2006
  • 0 replies
  • 0 views

Badge +4
After experiencing some bizarre behaviour yesterday, i thought i would post up my findings, since i couldn't find the answer on here or in any K2 documentation.

We have a process (see attachment) that has an activity which uses one of two escalations, depending on whether the activity has escalated before or not. This activity is basically for a user to view & perform an action on a document & if this doesn't happen within an initial timeframe, their team leader is notified. If this still doesn't happen within a subsequent timeframe then the team leader is notified again, repeatedly after the same subsequent timeframe has passed. So, for example, if a document hasn't been actioned initially within 12 hours, the team leader will be notified, and then subsequently every 24 hours after that, until the document is actioned.

Now, the code for the conditional escalation is as follows:

Initial Escalation Rule:
.Value);
int escalationDays = 0;
int escalationHours = 0;
int escalationMins = 0;
WorkflowHelper.Init(dataAccessProvider, connectionString);
WorkflowHelper.GetInitialEscalationDetails(repositoryDocId, out escalationDays, out escalationHours, out escalationMins);

K2.SetEscalationRule(escalationDays, escalationHours, escalationMins, 0, 0);
}


Subsequent Escalation Rule:
.Value);
int escalationDays = 0;
int escalationHours = 0;
int escalationMins = 0;
WorkflowHelper.Init(dataAccessProvider, connectionString);
WorkflowHelper.GetSubsequentEscalationDetails(repositoryDocId, out escalationDays, out escalationHours, out escalationMins);

K2.SetEscalationRule(escalationDays, escalationHours, escalationMins, 0, 0);
}


Now the problem i was getting was that the subsequent escalation action was being invoked as soon as this activity was reached, even though the escalation action had not used the SetEscalationRule method. This led to the email being sent to the team leader and then a continous loop of returning back to the activity, escalating & emailing the team leader!

The cause of the problem was basically that it appears you MUST use the SetEscalationRule method in the escalation rule event, otherwise the escalation action will immediately invoke. For example, something that would satisfy my requirement would be:

.Value);
int escalationDays = 0;
int escalationHours = 0;
int escalationMins = 0;
WorkflowHelper.Init(dataAccessProvider, connectionString);
WorkflowHelper.GetInitialEscalationDetails(repositoryDocId, out escalationDays, out escalationHours, out escalationMins);

K2.SetEscalationRule(escalationDays, escalationHours, escalationMins, 0, 0);
}
else
{
K2.SetEscalationRule(999, 0, 0, 0, 0);
}



Subsequent Escalation Rule:
.Value);
int escalationDays = 0;
int escalationHours = 0;
int escalationMins = 0;
WorkflowHelper.Init(dataAccessProvider, connectionString);
WorkflowHelper.GetSubsequentEscalationDetails(repositoryDocId, out escalationDays, out escalationHours, out escalationMins);

K2.SetEscalationRule(escalationDays, escalationHours, escalationMins, 0, 0);
}
else
{
K2.SetEscalationRule(999, 0, 0, 0, 0);
}



Sorry for the long post, i just hope it helps someone else out, if they come across a similar scenario.

Also, if anyone knows of a better way, i.e. being able to disable the escalation altogether in the escalation rule event, instead of having to set the escalation days to 999, then i would love to hear about it!

0 replies

Be the first to reply!

Reply