Problem with parallel activity/slots

  • 1 April 2009
  • 9 replies
  • 3 views

Badge +1

Hi, 


 


I have the following problem in K2.Net 2003:


I have a parallel Approval Activity that gets routed to 4 users (with “Create a slot for each destination”).


 


Group1:               User1 & User2  


Group2:               User3  & User4


 


I need at least one user from each group to approve. As soon as one user in a group approves, the worklist item should be removed for other users in the same group.


For Example:


 


When User1 approves, I want to remove the worklist item for User2, but it should remain in the worklists for User3 and User4.


 


The problem is, since I have created a slot for each destination user, once User1 approves, the item will remain in the worklist for Users 2, 3 and 4. (But I want to remove the item for User 2)


If I choose option “Limit the number of slots to 1”, once User 1 approves, the item will be removed for Users 2, 3 and 4. (But I want the worklist items to remain for User 3 and User 4)


So I need something in between the 2 options.


 


So how can I do this in K2.Net 2003?


Or is there a way to remove one specific slot from a user’s worklist?


 


Thanks in advance,


 


Rene


9 replies

Badge +8
I think u have enabled create a slot for each user, select create a slot for each group
Badge +1

I am using K2 2003.net, and there is no option for user/group. (in "Activity General")


I can only choose between "Create a slot for each destination" and "Limit number of slots to...".


Or am I missing something?

Badge +8
I would suggest you to split the activity into two seperete activities.. Each having one user group as destination.
Badge +1

The number of user groups is dynamic (depending on the user input in the previous Activity), so I don't know beforehand, how many Usergroups I need to route it to (it could be anywhere between 1 and 7 usergroups)


But is there a possibility to delete (or complete) one specific slot in K2?


In my example I would like to delete the worlistitem for User 2, when User 1 approves.

Badge +8
How are u forming the groups and adding users to those groups dynamically???
Badge +1

Ok, maybe "dynamically" is not the right word... this is what I am doing:


I have an InfopathForm with checkboxes. Depending on which checkbox are checked, I add the destinationgroups to the Infopath XML,


<my:Responsibles>
  <my:Responsible>group1</my:Responsible>
  <my:Responsible>group2</my:Responsible>
</my:Responsible>


Then in the Approval Activity - Destination Rule ("create a slot for each destination"), I read the destination groups from the XML (K2InfopathSchema), like this:


 foreach(XmlNode node in responsibles.ChildNodes) 
 { 
       string adGroup = node.InnerText; 
       string[] userList = ADHelper.GetUsersForGroup(adGroup); 
                        
                       //== sendto
                        foreach(string user in userList)
                        {
                                K2.Destinations.Add(DestinationType.User, user); 
                        } 
    }


This code works and creates a slot for each member of the group.


But as I said, now I want to remove the worklistitem as soon as one member of a group approves, whilst the items remain in the worklist of the other group members


 


 

Badge +10

I don’t see a clean way of handling this scenario.  To me the issue seems to be that when K2 assigns the destination users even if they’re in different groups then they’re all treated the same way for that activity and the succeeding rule.  Offhand I believe you’d have the same issue with blackpearl.


 


Possible workarounds:


1.        Create a loop back onto  that same activity.  Add an event that when one member of one group completes their work on  that activity will it will store the group name in a process datafield.  The activity completes but loops back on itself and using destination rules it can determine that group2 actually finished the activity and so it should only assign it to group1 for example.  The downside of this is that if you have email notifications it would send out multiple notificiations that would have a different URL because the SN would be different for this new activity.  If they’re getting their work from the k2 worklist webpart or the worklist it would probably be invisible to them.  Of course you would need to set some flag to know the second time the activity is started not to loop back on itself again and again but to continue down the normal workflow path.


2.       This one is a bit of a stretch and I personally wouldn’t go there unless I really had to.  However potentially after the member of the first group completes their work the activity calls an external dll passing the membership of the first group.  The dll which references the management api could potentially redirect the work of the remaining first group members to some phantom account.  This would effectively remove the work from the first groups worklist and allow the 2nd group to continue working on it.  The reason why it has to be an external assembly is that you can’t call manage or interact with a K2 process from the K2 APIs.  The process goes into an error state so you’ve been warned J.  Note I haven’t tested this scenario but I believe it should work. 


 


I hope this helps.


Tim


__________________________


Principal - Technologist

Caprivi Solutions Inc.
Toronto, Ontario 
Badge +1

Thanks, Tim!


Point 1) looks promising, but there it won't quite work in my case:


The activity has already been assigned to 4 users in my example User1, User 2 (group1) and User3, User4 (group2)


When User1 has finished the activity, I want the worklist item to disappear from User 2's worklist but it has to remain in User 3 and User 4's tasklist.


So how can I make the worklist item disappear from user 2's worklist? I think it will only disappear, when the ActInstDestination.Status is Completed. But this status field is read-only... otherwise I would set it to complete, once user1 is finished...


So as you suggested, I need a flag with the groupname that I set as soon as one user of a group completes the activity. (So far so good)


But now how do I "tell" the other worklistitems from the same usergroup to complete (or disappear from the worklist)


Thanks for your help,


 Rene

Badge +10

In option 1 after the user form group 1 actions his work the activity would actually finish and then loop back on itself.  The activity would restart using a destination rule assign the work to group 2.  Because the activity finishes group 1 and group2 worklist items would disappear and for group 2 they would then reappear when the activity restarts.


 So if you were looking at the audit trail you would see 2 instances of that activity.  As I mentioned in the first post not exactly clean but might be good enough.

Reply