*Moved to: http://fluentbytes.com/how-to-assign-a-work-item-to-a-group-and-actually-have-it-show-a-list-of-values/

Today I was asked one of the most asked questions related to work item tracking: “Can you can assign a work item to a group in stead of a person”?

My standard answer to this question is “yes” and I tell people this can be easily be done by setting the ALLOWEDVALUES to include the attribute expanditems = “false” and add list items that contain the TFS group names.

Since the question came from my team mate I said I would fix the work item type so he did not have to spend to much time for this simple change.

To my surprise I found that it is easy but you have to know one additional fact and that is that you must not have altered the System.AssignedTo to only allow valid users!

So what happened?

I have a work item type called “Deliverable”. This is a work item that can be assigned to a group of developers, designers, testers, etc. So the requirement was simple, have this work item only assigned to a group in stead of a person. What I did was quite simple, for each state definition I just set the ALLOWEDVALUES to the list of groups I want to have the work item assigned to. See the example below:

 <br />&lt;STATE value="Scoped"&gt; <br />&nbsp;&nbsp; &lt;FIELDS&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;FIELD refname="System.AssignedTo"&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ALLOWEDVALUES expanditems="false"&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;LISTITEM value="[project]\Project Managers" /&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;LISTITEM value="[project]\Feature Managers"&nbsp; /&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;LISTITEM value="[project]\Software Architects" /&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;LISTITEM value="[project]\Designers" /&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;LISTITEM value="[project]\Implementers" /&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;LISTITEM value="[project]\Testers" /&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;LISTITEM value="[project]\Integrators" /&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/ALLOWEDVALUES&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;REQUIRED /&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/FIELD&gt; <br />&nbsp;&nbsp; &lt;/FIELDS&gt; <br />&lt;/STATE&gt; <br />

After uploading the work item, I got a strange surprise, the assigned to field always appeared empty [:(]


It took me quite some time to figure out what happened here. I finally figured out that this is caused by the fact that the Work Item Field definition for System.AssignedTo has a constraint set of <VALIDUSER/> and a TFS group is not considered to be a valid user. (This is something that probably your custom work item has as well since the common way to customize your work items is to pick the Microsoft work items and change those. The Microsoft work item types have this constraint set as well )

 <br />&lt;FIELD reportable="dimension" type="String" name="Assigned To" refname="System.AssignedTo"&gt; <br /><strong>&nbsp; &lt;VALIDUSER /&gt; <br /></strong>&lt;/FIELD&gt; <br />

So to fix this problem, I removed the <VALIDUSER/> constraint on the System.AssignedTo field. After removing the constraint and restarting Visual Studio after uploading the new type definition(I used WITImport at the command line, but this can also be done using the power tools) , the dropdown will show the options I expected to see.


So it is nice when you know the answer , but here you can see again that only knowing the answer is not enough to be productive, you actually have to have done this so you also know the problems you might run into [:)]


Hope this keeps you from pulling your hair out.


Follow my new blog on http://fluentbytes.com

6 thoughts on “How to assign a work item to a group and actually have it show a list of values

  1. what happens if the members of the tfs-groups have subscribed to notifications via email? Do all of them receive a mail or does none?

  2. Good question :-)

    If you are using the default Project Alerts Dialog in Visual Studio, you can only select work items that are assigned to you as a person, not a group. When you use the Power Tools plug-in, you can set an alert to be fired to you once a work item is assigned to the group. So it really depends on how you create the subscription.

  3. Is it also possible to have bothe groups AND the valid users in the dropdown? Sometimes it’s great to assign a WI to a group so that any of the group can start the WI, other times you want to specifically assign one member of the group.


  4. Owin,
    The default behavior is that when you set the to a group the group and it’s members are shown in the list. When you set the FilterGroups property then you will see only the members of the group. If you still have the rule on the assignedTo Field, it might look like the group is not there, but that is because it get’s filtered by the rule at the top level field definition. So remove that restriction on the field and you will see the exact behavior you want.