Friday, 30 May 2014

Experiment on Limit AssignedTo field of WIT to Team Members

A question in MSDN Forum lead me to do some experiments on restricting AssignedTo field of a work item to Team Members.

Here are some notes

1. I created team project CustomizeTest
2. This created default team "CustomizeTest"
3. I tried modifying Bug WIT template AssignedTo field

<ALLOWEDVALUES expanditems="true" filteritems="excludegroups">
    <LISTITEM value="[project]\CustomizeTest" />
  </ALLOWEDVALUES>

TFS template was not imported. Error
Error importing work item type definition:
TF26204: The account you entered is not recognized. Contact your Team Foundation Server administrator to add your account.
4. Created a new team "Team1" and tried with

<ALLOWEDVALUES expanditems="true" filteritems="excludegroups">
    <LISTITEM value="[project]\Team1" />
  </ALLOWEDVALUES>

Wow it works fine.
5. So where did I go wrong.... Got it... The default team of team project "CustomizeTest" is created as "CustomizeTest Team"

<ALLOWEDVALUES expanditems="true" filteritems="excludegroups">
    <LISTITEM value="[project]\CustomizeTest Team" />
  </ALLOWEDVALUES>

Works fine.
OK That is that and it works...BUT

Another experiment notes

1. I assigned one member to my Team1
2. Customized Bug WIT AssignedTo field to have

<ALLOWEDVALUES expanditems="true" filteritems="excludegroups">
    <LISTITEM value="[project]\Team1" />
  </ALLOWEDVALUES>

3. Went into Team project CustomizeTest\Team1 and tried creating Bug. Assigned To field drop down have only one member. yeah I am happy.
4. Went into root team project CutomizeTest (CustomizeTest Team) Create Bug. AssignedTo field only has that one member in Team1. Ok it should be since I have made it to work like that.  (my CutomizeTest Team has 3 Members but I can assign a bug in this team only to one member of the Team1, looks like I made some bad customization)
5. I created another Team "Team2" with 2 members.  and modified my Bug WIT AssignedTo field to have

<ALLOWEDVALUES expanditems="true" filteritems="excludegroups">
    <LISTITEM value="[project]\Team2" />
  </ALLOWEDVALUES>

Now when I go into "CustomizeTest Team", "Team1" and "Team2". Create a bug I can assign it to only to the two members of the "Team2".
6. I changed my Bug WIT AssignedTo field to

<ALLOWEDVALUES expanditems="true" filteritems="excludegroups">
    <LISTITEM value="[project]\Contributors" />
  </ALLOWEDVALUES>

and I added teams "CustomizeTest Team", "Team1" and "Team2" as members of [project]\Contributors.
This lists all members from the three teams in my AssignedTo field regardless of the team I am in.
Think all above my experiments will help someone in some way.

If there is  a way to say <LISTITEM value="[project]\<TheCurrentTeam>" /> which would be wonderful to have I think.






































1 comment:

Jesse Houwing said...

Have you tried:








It would be not be ideal, since you'd need to change the values each time a team is added or removed or renamed, but it's a workaround that should work for now, as you can have multiple ALLOWEDVALUES rules on the same field.