Using Work Item Templates
Work Item Templates allow you to work faster and more effectively with your TFS Work Item Tracking system.
The VSTS 2008 Team Foundation Server Power Tools is designed to deliver enhancements to the TFS user experience. There are several tools in the set, including a Team Foundation command-line tool, a process template editor and the TFS Best Practices Analyzer. For this column, we'll look at another feature provided by the Power Tools: Work Item Templates.
Work item templates give you the ability to automatically populate fields in a TFS work item type. This lets you easily create or update work items while reducing the number of steps in the process. For instance, you may find that when you create certain work items, you're constantly entering the same information in certain fields again and again. For that scenario, Work Item Templates will decrease the amount of time you spend editing your work items. You can download the October 2008 release of the Power Tools here.
Creating a New Work Item Template
Let's say that every time you create a new Task work item, you're always entering the same Area and Iteration information. You want to use Work Item Templates to help speed up the entry of your Task work items. You have two options for creating a Work Item Template: You can take an existing work item and derive a work template from it, or you can create a new template from scratch.
Let's tackle the first option. To create a template from an existing work item, first open the work item. Next, right-click on the work item (see Figure 1), and select Capture Template... from the context menu.
This will open the Capture Template window, as shown in Figure 2. For every field on the work item with data, this window displays the field name and the value of that field. Using this window, enter a name for your Work Item Template and a description, and select which field/value pairs you want to be a part of it. Once you're done, click the Save button. Templates are saved into the Work Item Templates folder in the Team Project you're working with (see Figure 3). This is a new folder added to your Team Projects by the Power Tools.
As I mentioned, you can also create a Work Item Template from scratch. First, open Team Explorer and the Team Project you're working with. Right-click on the Work Item Templates folder and select New Template. You'll be prompted to select a work item type to create a template of. For this scenario, select the Task work item. This opens the Task work item in "template mode," allowing you to fill in the fields you care about on the task, then name and save the template (Figure 4). Only the fields that you've filled in will be saved to the template.
Using Work Item Templates
Now that you have your Work Item Templates, let's see how easy it is to use them to create work items. In Team Explorer, open the Work Item Templates folder, right-click on the template you want to use and select Create Work Item. Presto! The appropriate work item type will open, and the Work Item Template will automatically populate the fields of the work item (Figure 5).
If at a later point you need to modify a Work Item Template, simply double-click the template in the Work Items Template folder to open it. The same window as shown in Figure 4 will open, and you can modify the template as you see fit.
As you can see, Work Item Templates can greatly enhance your experience with the TFS Work Item Tracking System. It's a quick and easy way to pre-populate work items with required data while reducing data entry time.
Mickey Gousset spends his days as a principal consultant for Infront Consulting Group. Gousset is lead author of "Professional Application Lifecycle Management with Visual Studio 2012" (Wrox, 2012) and frequents the speaker circuit singing the praises of ALM and DevOps. He also blogs at ALM Rocks!. Gousset is one of the original Team System/ALM MVPs and has held the award since 2005.