Skip to main content

Hello There,


I have a list of users. I have to assign the users to the destination of the next activity.


How to achieve it dynamically.


 


 


Regards


Amarnath

The best approach, I feel, is to make a smart object that can get the users for your task, and use the smart object call in the destination wizard.  That is kind of a high-level statement, let me know if you need more details and maybe I can put together an example.


An alternative approach is to use code to populate an xml data field with the users that the task can be assigned to and then use that XML datafield in the destination wizard. 


Hello Amarnath,


I have done this yet.


I assign the list of users to a process datafield in  a string that separated with ";", also make some code in process,add the code underware to destination rule.


K2.Destinations.Remove(DestinationType.User, K2.ProcessInstance.DataFieldsd"AddApproveUser"].Value.ToString());
            stringÂ] users = K2.ProcessInstance.DataFieldsc"AddApproveUser"].Value.ToString().Split(',');
            foreach (string user in users)
                K2.Destinations.Add(DestinationType.User, user);


This method is not good but solved the problem.I think k2 need a new datafield type for array.


Hello Winefish,


Thank You for the quick reply.


I have achieved something similar.


Although i am not able to access the "K2.Destination.add" in the server code.


I had to write the code in the destination rule of the activity. Am I missing something?


 


Regards


Amarnath


This thread might help http://www.k2underground.com/forums/t/8272.aspx


I am not sure if it is working properly.


even if i create one slot. It is not working as expected.


Can Anybody Help me!!!!!!


Regards


Amarnath


It might help if you had some screenshots showing your configuration and the destination field value you are using.


Hi Amaranath,


I had a similar requirement and got it working using a process xml field with a repeating node and using the repeating node as the Destination.


In the following sample XML field (I called DestinationUsers), the ’UserName’ element is a repeating node.


<XmlDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Users>
 <UserName>k2:DOMAINNTUserName1</UserName>
 <UserName>k2:DOMAINNTUserName2</UserName>
 <UserName>k2:DOMAINNTUserName3</UserName>
 <UserName>k2:DOMAINNTUserName4</UserName>
 <UserName>k2:DOMAINNTUserName5</UserName>
  </Users>
</XmlDocument>


Once the Destination is set to the repeating node of the xml field, each user in the repeating node will become a Destination User.


Please refer to the Advance Destination artical from K2 for more information. That has some nice examplse about how to achieve this.


http://www.k2underground.com/media/p/20948.aspx


Let us know how it goes


Cheers


Nadun


Please provide me some steps how to set the dynamic destination users for the event from Infopath User selection control.


I mean depending upon the user selection it has to assign the dynamic users for the activity.


please provide me some realtime example.


Did you see this?


http://www.k2underground.com/blogs/fromthebench/archive/2008/05/22/activity-destination-users-based-upon-a-repeating-xml-element.aspx


Reply