Create a Dependent Pick List

You can create a dependent pick list to use with a work item type field by exporting the XML file and modifying its content. As soon as you have added the dependent pick list, you can import the XML file to start to use the updated work item type.

The following procedure tells you how to create a dependent pick list for the Task work item type.

Required Permissions

To perform this procedure, you must be a member of the Team Foundation Administrators group or a member of the Project Administrators group for the project. For more information, see Team Foundation Server Permissions.

To create a dependent pick list

  1. If you are modifying a work item type on a single project, run witadmin exportwitd to export Task.xml. For more information, see Customizing and Managing Work Item Types [witadmin].

  2. In Visual Studio, click File, click Open, and then click File.

    This displays the Open File dialog box.

  3. Under Look in, move to the location where you exported the file.

    If you are modifying a work item type to customize a process template, move to the location where you downloaded the process template.

    Note

    If you are running Windows Vista you might not have permissions to certain folders. If you try to export the work item type to a location where you do not have permissions set, the registry virtualization technology automatically redirects the exported file and saves it to the virtual store. To avoid this redirection, you can export the file to a location where you have permission set. For more information about registry virtualization, see the Microsoft Web site: Registry Virtualization and Common file and registry virtualization issues in Windows Vista.

  4. Select Task.xml, and then click Open. When you are prompted about line endings, click No.

  5. Find the <FIELDS> section of the XML file.

  6. Add the Category field, and set the allowed values to depend on the value of the Discipline field by adding the following XML:

    <FIELD name="My Field" refname="MyCompany.MyProcess.MyField" type="String" reportable="dimension">
      <WHEN field="Microsoft.VSTS.Common.Discipline" value="Requirements">
        <ALLOWEDVALUES>
          <LISTITEM value="Planning" />
          <LISTITEM value="Review" />
        </ALLOWEDVALUES>
      </WHEN>
      <WHENNOT field="Microsoft.VSTS.Common.Discipline" value="Requirements">
        <ALLOWEDVALUES>
          <LISTITEM value="Process Management" />
          <LISTITEM value="Planning" />
          <LISTITEM value="Review" />
        </ALLOWEDVALUES>
      </WHENNOT>
    <DEFAULT from="value" value="Process Management" />
    </FIELD>
    

    Note

    The WHEN and WHENNOT rules used in this example can also be applied to other rules to specify when those rules should be evaluated. For more information, see Specifying Conditions: WHEN, WHENNOT, WHENCHANGED, and WHENNOTCHANGED Elements.

  7. Delete the DEFAULT rule, shown as highlighted in the following XML.

    You can delete the DEFAULT rule because the allowed values for My Field now depend on the Discipline field.

    <FIELD name="My Field" refname="MyCompany.MyProcess.MyField" type="String" reportable="dimension">
      <WHEN field="Microsoft.VSTS.Common.Discipline" value="Requirements">
        <ALLOWEDVALUES>
          <LISTITEM value="Planning" />
          <LISTITEM value="Review" />
        </ALLOWEDVALUES>
      </WHEN>
      <WHENNOT field="Microsoft.VSTS.Common.Discipline" value="Requirements">
        <ALLOWEDVALUES>
          <LISTITEM value="Process Management" />
          <LISTITEM value="Planning" />
          <LISTITEM value="Review" />
        </ALLOWEDVALUES>
      </WHENNOT>
    <DEFAULT from="value" value="Process Management" />
    </FIELD>
    
  8. On the toolbar, click Save to save the changes to Task.xml.

  9. Import the updated work item type.

    To import the new work item type to a single project, see Customizing and Managing Work Item Types [witadmin].

    To add the work item type to your process template, see Add a Work Item Type to a Process Template.

To verify changes imported to a single project

  1. In Team Explorer, click Refresh to download the latest updates from the server.

    These updates include the changes that you just imported. Wait several seconds until the Work Items node is loaded. Nodes that are still loading are labeled working.

  2. Create a task work item by, right-clicking the Work Items node, pointing to Add Work Item, and then clicking Task.

    This task is created from the work item type that you changed and imported.

  3. Select the modified field to see its values.

  4. Select Requirements in the Discipline field, and then select the modified field to see how its values change.

  5. Click Close to close the new task. Click No when you are prompted to save the task.

See Also

Tasks

Create a Pick List

Set a Default Value

Make a String Field Match a Pattern

How to: Customize the Assigned To Field

Concepts

Specifying Conditions: WHEN, WHENNOT, WHENCHANGED, and WHENNOTCHANGED Elements