Skip to main content
When writing a succeeding rule, what is the difference in the logical functions "All" and "All Slots" ??

I'm trying to stop an activity from progressing until all activity instances have been completed by users (marked using activity data fields) i.e. when all activity instances have an activity data field set to true the workflow can advance ?

Can somebody explain the difference between "All" and "All Slots" ??

Thanks a lot,

Chris
There is an article on the knowledge base which explains how to do this:

How to prevent an activity from completing until all slots have been completed.

If you do not yet have a portal user account, contact me by mail and I will email the article to you: neil'at'k2workflow.com.removethis
The 'all' and 'all slots' logical functions are very similar, although All works on all instances of a destination. For example, if you have an activity with 10 destination users but have limited it to 5 slots, the all function will evaluate all 10 destinations, not only the 5 slots.

The all slots function obviously test only for the 5 allocated slots, and a slot will only be allocated once a user has clicked on the item in their worklist.

Of course, if you are evaluating a data field in respect of slots in the succeeding rule, you must create the datafield as an ACTIVITY datafield, not a process datafield.

Hi,


I have 2 destination users for an activity. I have a line rule from that activity to the next activity. The line rule is "[{K2.ActivityInstanceDestination.DataFields("Result").Value}] = "PASS" " .


Now , my doubt is with respect to "All Slots" and "At Least" logical function.


I found the following :


If I set the Logical Function as "All Slots" then  if one destination user updates the datafield Result to PASS and the other user finishes the worklistitem, then Control is not passed to the next activity.


But if I set the Logical Function as "At Least 1" then  if one destination user updates the datafield Result to PASS and the other user finishes the worklistitem, then Control is  passed to the next activity.


I update the value using the following statements:


oWorkListItem.ActivityInstanceDestination.DataFieldsl"Result"].Value = "PASS";


oWorkListIem.Update();


Here oWorkListItem is an object of WorkListItem class.


The same thing happens irrespective of whether the workListItem is opened or not.


 Is this the way "All Slots" and "At Least" logical function work ?


Please guide.


Thanks and Regards.


How many slots do you have set for this specific activity?


You can check by right-clicking on Activity and selecting properties.


download.aspx 


 


I noticed in another post (http://k2underground.com/forums/thread/17872.aspx) that you mentioned that you had set "Create slot for each destination".


If this is the case, then the behavior you are experincing is expected and exactly how Slots and Succeeding Rules are meant to operate.  A slot tells K2 how many unique responses it should expect for a multi-destination activity.  If you create a succeeding rule that states:


   ALL Slots "t{K2.ActivityInstanceDestination.DataFields("Result").Value}] = "PASS


Then K2 will return true for this succeeding rule when ALL destination users have set the value to "PASS".


However if you create a suc. rule that states:


  At least 1 Slot " {K2.ActivityInstanceDestination.DataFields("Result").Value}] = "PASS


Then K2 is only expecting one person (destination) to set the value to "PASS".


 


Hi Bob,


Thanks a lot for replying.


Hi Bob,


Does it mean that if I have 2 destination User for that activity and I have created a slot for each destination and with the succeeding rule being All Slots then only if both the users update the datafield value to PASS, then only the suceeding rule returns true and also then the activity would complete?


Pls guide.


Thanks and Regards


Hi,


Is this right ?


With reference to my reply, without updating the Datafield "Result" to PASS by any of the user, I finsihed the Client event in the activity that has the Succeeding Rule as "At least 1 slot" , yet the WorkListitem got finished and hence the activity also finished. Does it mean that we can bypass the Succeeding Rule by directly finishing the WorkListItem which will finish the activity ?


Pls guide.


Thanks and Regards


Hi All,


I hope I finally got it right.


Irrespective of whether the Succeeding rule has "All slots" or "At least " logical function, if the WorkListItem is finished, then the activity completes. Completeing the activity is indepenedent of the Suceeding Rule. It is dependent only the WorkListItem. If worklistitem finishes , then activity completes.


Am I right ?


First a little background... 


A WorklistItem corresponds to a Client Event within the K2 process definition.


When an activity has multiple destinations, each destination gets it's own instance of the activity.  This is in addition to the Activity instance itself.  So, if an activity has 2 destinations, when the process executes, there is first an ActivityInstance created, then two individual ActivityInstanceDestinations (one for each destination user).


So, when a user Finishes, his WorklistItem, he is really completing the Client Event within his specific ActivityInstnaceDestination.  If there are no more server events to execute after the client event, then the ActivityInstanceDestination for this user will complete, at which time the ActivityInstance Succeeding Rule will execute and check the logic.  If the Succeeding Rule returns true, then it will complete the ActivityInstance and then K2 will execute the line rules exiting the Activity.  If the Succeeding Rule returns false, then the ActivityInstance (and any current ActivityInstanceDestinations) stay active and K2 waits for the response from an ActivityInstanceDestination, at which point the cycle repeats.


I believe irrespecive of what the Succeeding Rule states, K2 has an internal rule that states if all slots have been filled then the succeeding rule will return true.  This is to protected against situations where a poorly written succeeding rule could result in an ActivityInstance staying active even though all tasks (ActivityInstanceDestinations) have been finished, thus the process instance would be in an virtual "frozen" state.


 


HTH


 


Hi Bob,


Thanks a lot for replying.


That was a ripper.


Reply