Skip to main content

I'm in a situation where I need to assign a task to multiple destination users who are defined by the union of multiple groups (geograpy / role).  The client doesn't want to use roles to manage this information, so I'm going to need to use a custom AD query to get the list of users.


My currrent plan is to attempt a custom smartObject to query for the user accounts and an XML field to assign them to the activity.  Only one of the users would have to action the workitem, so I'm assuming that I can live with a single slot. 


 Does this make sense or is there a better approach before I start down this road?

I would think that a combination of roles and destination rules for each destination set would meet your requirements.


 Any specific reason why roles is not wanted here?  Considering that it's either managing that or managing it in your custom SmartObject, I would think that roles would be easier to maintain over time.


Users exist in groups by role and by region, so in order to determine the correct user we have to find the union of role and region.  When determining the destination we're going to need to send it to a regional manager where the region is dependent on some data in another smart object.

The user doesn't want to have to create and manage roles in Active Directory AND in K2.  I'll be the first to admit shallow knowledge of K2s capabilities with roles, so if there's a better way, please let me know.


Given that your users don't want to manage it in both AD and K2 Roles.


It sounds like they are already managing roles from AD.


So if you stick with AD as the role provider, you could just assign based on AD security roles.  e.g. AP-Finance-Manager, EMEA-HR-Manager, etc.


The danger of this is that without proper role identification and consolidation, this could lead to a role bloat if developers indescriminately add new AD security groups.


I wouldn't recommend doing it from code as it just pushes the responsibility of the role management to your code (which could also turn into an ugly monster).


hi...I have a little question..


i already have 3 users who assigned to an action..now my problem is who to make the engine uderstand that i want it wait till the 3 of them will approve it and if one of them is rejecting the flow eill move the task to someone else..


I also tried to use the actions but i fount that my WorkListItem.count==0....:( maybe u can help me with this too???


 


im new in the K2..i worked with another BPM tool so im still trying to understand how things are working here.............


thank you,


Hen


This would be a typical voting scenario.  Simplistically speaking, configure 3 slots on the destination rules and then edit the outcome rules to evaluate to Approve if at least 3 slots = Approved and evaluate to Rejected if at least 1 slot = Rejected.


 By default, the outcome rules always evaluates to All slots = <Action Result>


 As to why your worklistitem count is 0, I would run the K2 server in console mode and see what credentials you are connecting as.


 In most cases, it is either you forgot to put the <identity impersonate="true"> tag in your web.config or you are running the page inside the Visual Studio web listener (i.e. not in IIS).


Just wanted to mark this as resolved.  I created an XML field with the format:


<Accounts>
<Account>K2:DOMAINjohn</Account>
<Account>K2:DOMAINjane</Account>
</Accounts>


I populated this field with the following server event code:


StringBuilder

roleMembersBuilder = new StringBuilder();


roleMembersBuilder.Append(

"<Accounts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">");


foreach(RoleWS.RoleInfo roleMember in roleMembers)


{


roleMembersBuilder.AppendFormat(

"<Account>K2:{0}</Account>", roleMember.Account);


}


roleMembersBuilder.Append(

"</Accounts>");


K2.ProcessInstance.XmlFieldss

"RoleMembers"].Value = roleMembersBuilder.ToString();


 


I then assigned the account element as the destination with the plan per destination / "all at once" option, using a single slot and the option "Create a slot for each role".  This will assign the worklist item to all the users, but only allow a single one of them to action it.


 


 


Just wanted to mark this as resolved.  I created an XML field with the format:


<Accounts>
<Account>K2:DOMAINjohn</Account>
<Account>K2:DOMAINjane</Account>
</Accounts>


I populated this field with the following server event code:


StringBuilder

roleMembersBuilder = new StringBuilder();


roleMembersBuilder.Append(

"<Accounts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">");


foreach(RoleWS.RoleInfo roleMember in roleMembers)


{


roleMembersBuilder.AppendFormat(

"<Account>K2:{0}</Account>", roleMember.Account);


}


roleMembersBuilder.Append(

"</Accounts>");


K2.ProcessInstance.XmlFieldss

"RoleMembers"].Value = roleMembersBuilder.ToString();


 


I then assigned the account element as the destination with the plan per destination / "all at once" option, using a single slot and the option "Create a slot for each role".  This will assign the worklist item to all the users, but only allow a single one of them to action it.


 


 


Reply