in our company this is a quite common scenario, so may be this will also be helpful for other.
For many of our workflows there is an coordinator activity. It usually has only one destionation user. This user receives the request and then forwards it to the required departments, or better one user (the one with less workload) of this department. This also means that you need to be able to set the destination users for the next activities dynamically.
I don't know if the way I implemented it is a Best Practice but anyway:
First thing what needs to be done is to create Active Directory Groups with the users you need for the process. When this task is finished you can use the following webservice to get all credentials form each user in a group (in my case "cn, mail, samaccount", put all code in one class now).
)al.ToArray(typeof(Credentials));
}
}
}
The xml structure you get from the service looks like this:
<?xml version="1.0" encoding="utf-8" ?>
- <ArrayOfCredentials xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://tempuri.org/">
- <Credentials>
<Name>cn(Luxembourg)</Name>
<Account>samaccountname</Account>
<Mail>mail address</Mail>
</Credentials>
- <Credentials>
<Name>cn (Luxembourg)</Name>
<Account>samaccountname</Account>
<Mail>mail address</Mail>
</Credentials>
</ArrayOfCredentials>
Now in InfoPath create a new Data Connection to receive data from a Web Service. Create a drop down list and populate it with the values form the web service. Select the xml Account element (samaccountname) for the value and the and the Name (cn) as the display name. This is actually already what you need. After you ran the InfoPath wizard in K2 and bound the views to the activities do the following:
Right click an activity for which you want to set the dynamic destination and select properties, select Destination Rule, right click into the Destinations area and select "Create New Destination". Right click on the "Send To" option and select "Insert K2.net Data", now navigate to the Drop Down List which you populated with the values from the Web Service. That's it. The user can select someone form the DDL and the item is forwarded to exactly this member.
What then also usally is required is that we have a notification mail to exactly this selected person after the coordinator submitted his task. To realize this you need an additional textbox to your InfoPath document.
Double click the Drop Down List you created before and select Rules. Name the rule "Set Mail" for example. Select the "Set a fields value" option. For the field select the textbox you added to your form. Now there comes the only little tricky part: As the value click the "fx" and copy the following formulat into it:
/tns:Mail
Now each time you select a user from the DDL the matching mail address will be writen into the textbox. This textbox value you can then use in a Server Event within your K2 Workflow to specify the mail address.
May be someone can use this information.
Cheers