Skip to main content
Hi there,

I have a listbox with a list of users, which I want to be able to use as the destination users in the next activity. How do I do this. Because when I try and work in the next activities client page it will basically only allow me to work in an activityinstancedestination. So obviously it is to late to do this.

Must it be done in the previous activity where the listbox with users are? And how do I change the destination users for the next activity you are working with and not globally for all the instances of that activity?

Regards

Nic Scheepers
Hi NicS,

You are correct -> You have to save the destination users of the next Activity before you enter the activity.

So what you need to do is capture the required destination users on your ASP page and save this into process level XML.

You will now require some looping code to read each destination user from the XML in the Destination Rule (code-behind). In this loooping code you will require a line to add the name just read from the XML:

Dim MyNewK2DestUser As New KO.Destination(KO.DestinationType.User, "Name from XML")

Have a look at the 'Add Method' in the K2.net Studion helpfile.
FWIW, here is a code sample to read usernames in a repeating XML element and add each name as a destination for the activity instance:

.Value, "my:myFields/my:DestinationUsers/my:DestinationUserName"); 
for (int i = 0; i < xmlNodeList.Count; i++)
{
K2.Destinations.Add(DestinationType.User, xmlNodeList.Item(i).InnerXml);
}


my XML looks something like this:

<my:myFields xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-09-30T07:00:26">
<my:DestinationUsers>
<my:DestinationUserName>domainusername1</my:DestinationUserName>
<my:DestinationUserName>domainusername2</my:DestinationUserName>
<my:DestinationUserName>domainusername3</my:DestinationUserName>
</my:DestinationUsers>
<my:SomeValue>Some Text Value</my:SomeValue>
</my:myFields>

Thanks guys this helped me a lot.

Reply