Redirect Escalations with Succeeding rules using multiple slots

  • 5 July 2007
  • 1 reply
  • 1 view

Badge +10

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,


1 reply

Badge +13

Nice find, do you know if # of destination would also increase if one of the approver did a manual redirect (instead of redirect escalation)?


Reply