A General posting:
Scenario:
You have an activity with multiple destinations and each destination has its own slot.
You have a succeeding rule on this activity which checks the status of each slot and then performs some action.
The succeeding rule code could look something like this:
int count = 0;
foreach (SourceCode.KO.ActivityInstanceDestination ActInstDest in K2.ActivityInstance.Destinations)
{
if (ActInstDest.Status.ToString().ToUpper() == "COMPLETED")
{
count++;
//Do some work
}
}
if (count == K2.ActivityInstance.Slots)
return true;
else
return false;
However, if this activity has uses a redirect escalation and the activity re-assigns the work to someone else, the number of slots after the escalation will be the total number of destinations (Activity Destinations + Escalation Destinations).
This will cause your succeeding rule to evaluate to false if the above code is used. This completes the process without moving on to the next activity.
Workaround:
Count the number of destinations that did not expire and update this in a variable. Next compare the number of completed items to this variable.
int count = 0;
int noSlots = 0;
foreach (SourceCode.KO.ActivityInstanceDestination ActInstDest in K2.ActivityInstance.Destinations)
{
if (ActInstDest.Status.ToString().ToUpper() != "EXPIRED")
noSlots++;
if (ActInstDest.Status.ToString().ToUpper() == "COMPLETED")
{
count++;
//Do some work
}
}
if (count == noSlots)
return true;
else
return false;
Regards,