TFS 2010 - Edit Work Item Type Definition using Team Foundation Power Tool

Posted by: Subodh Sohoni , on 8/26/2011, in Category Visual Studio, VSTS & TFS
Views: 76143
Abstract: We began a series of articles on Customize work item type definition in TFS 2010. In the first part of this series we had seen how to use a tool WitAdmin to export the work item type definition of Bug work item and then import it back in TFS after making a small modification in it, as Defect work item type definition. In this article, we will do a non-trivial modification in the Defect work item, using Team Foundation Power Tool.

We began a series of articles on Customize work item type definition in TFS 2010. In the first part of this series we had seen how to use a tool WitAdmin to export the work item type definition of Bug work item and then import it back in TFS after making a small modification in it, as Defect work item type definition. In this article, we will do a non-trivial modification in the Defect work item, using Team Foundation Power Tool.

As in previous article, we will do the walkthrough using the virtual machine created by Brian Keller. Whatever we did in the first walkthrough is a prerequisite for this one and if you have not done that walkthrough, then I suggest you to go back to first part of this series and complete that walkthrough before starting this one.

We will begin with using the Process Editor tool of the Team Foundation Power Tools to open the work item type definition of Defect work item.

Step 1: In the virtual machine, start Visual Studio 2010. If it is already open, then Refresh Team Explorer so that all the changes that you have done in the earlier exercise, will be rewritten in the cache of Visual Studio. This virtual machine has the installation of Team Foundation Power Tools that makes work item type definition customization task easy, non-tedious and less error prone.

 

Step 2: In the menu of the Visual Studio 2010, open Tools – Process Editor – Work Item Types – Open WIT from Server. We may open the WIT from a file like Bug.xml that we had created in the first exercise but it will have to be imported to TFS after editing to take effect.

wit-tfs

Step 3: Connect to TFS and Default Collection

team-project-collection

Step 4: Select Team Project “Tailspin Toys” and work item type Defect which was created in the earlier exercise.

work-item-type

Step 5: Team Foundation Power Tool has a GUI Editor for Work Item Type Definition editing. Defect work item type is opened in that.

gui-editor

You will be able to see the General Properties like Name, Description and three tabs for special properties that are Fields, layout and Workflow. We will add a new field in the Fields tab and add a control to show that field in the Layout tab. Finally we will add a state and transitions in the Workflow tab.

Step 6: We will add a field for “Organizational Department”. Click on the New icon on the Fields tab. It opens a field definition wizard that will create a field for us.

field-definition

Step 7: In the text box for Name, provide the name: Division. Let the type remain same i.e. String but you may have a look at the other data types that can be assigned to the field. Reference name is the fully qualified name, by which the field will be known internally within the definition, as well as for programs using Team Foundation Object Model. Give the value SSGS.Division to Reference name. In the help text, enter the value: Stores the organizational division under which this Defect is being filed. Set the value Dimension to the Reportable attribute. The Definition should look similar to the one shown below:

field-definition-reportable

Step 8: Now we will add a set of rules to follow (about this field) at the time when the work item of the type Defect will be saved. Click the tab for Rules.

field-definition-rules

Step 9: Click on the New icon to add a rule. The First rule that we will add is that whenever the work item of the type Defect will be saved, field Division has to be given some value. From the list box, select the rule REQUIRED. Do not add any other attribute to this rule and click OK twice to save this rule.

rule-type

Another rule that we want to add is that user will be able to select value only from some allowed values. You will use the Global List Organizational Division that you had created in the earlier exercise. Click New icon to add another rule. Select the rule ALLOWEDVALUES.

allowed-types

When you click OK on this screen, you will see the editor for allowed values.

allowed-types-editor

Click on the New icon to provide the values to the list of allowed values. It opens a list item editor. In the dropdown of that you will find the Global List that named “Organizational Divisions” that you had created in the earlier exercise.

list-item-edit

Select that Global list and click OK. Click OK twice again to save the field definition.

Step 10: Click the layout tab and click Preview Form button on that.

preview-form-button

You should add the Division field in the Classification group since it is one of the ways of classifying the defects. Close the preview form.

Step 11: In the layout tree, trace to the group named Classification. Right click on the Column under Classification group and select Add Control.

classification-group

In the properties of new control, select the property Label and change the value to Division. Set the value of property Field Name to SSGS.Division from the dropdown.

ssgs-division-workitem

Step 12: Click the Preview Form button again and preview of Classification group should look similar to the following:

classification-group-preview

Close the preview.

Step 13: Click the tab of the Workflow now. Existing workflow that has come from Bug Work Item Type looks as follows:

workflow-tab

 

Step 14: From the toolbox drag and drop a State shape below Active state. In the properties of that shape, set the name property to Under Investigation.

Step 15: Select the transition shape in the toolbox. Click on the space below Under Investigation state and drag and drop it over the Under Investigation state. A new transition appears. Reposition it at the convenient location. Right click on it and go to Reasons tab. Change the value of default reason from “.” To “New”. Delete the transition that goes from “ “ to Active State.

transition-shape

 

Step 16: Again select the transition shape in the toolbox. Click on the state Under Investigation and drag and drop it over the Active state. A new transition appears. Reposition it at the convenient location. Right click on it and go to Reasons tab. Change the value of default reason from “.” To “Defect Accepted”. Create a similar transition from Under Investigation state to Close state. Provide the reason as “Defect Rejected”.

Step 17: Resulting workflow should look like this:

workitem-edit-workflow

Step 18: Save the work item type definition and close the editor.

Step 19: In the team explorer, select the node of Work Items; right click on it and select New Work Item of the type Defect. Observe all the changes that you had done in the type definition getting reflected in the work item itself.

Summary: In this article, we have viewed the entire process of editing the work item type definition using the Team Foundation Power Tool. Any work item is defined by Fields (data it stores), layout (the way to visualize that data) and workflow (states and transitions supported by that work item type). We have edited all these in this article.

Give me a +1 if you think it was a good article. Thanks!
Recommended Articles
Subodh Sohoni, Team System MVP, is an MCTS – Microsoft Team Foundation Server – Configuration and Development and also is a Microsoft Certified Trainer(MCT) since 2004. Subodh has his own company and conducts a lot of corporate trainings. He is an M.Tech. in Aircraft Production from IIT Madras. He has over 20 years of experience working in sectors like Production, Marketing, Software development and now Software Training. Follow him on twitter @subodhsohoni


Page copy protected against web site content infringement by Copyscape


User Feedback
Comment posted by Dick Norman on Thursday, September 1, 2011 9:10 AM
Excellent post, but weak on step 15.  
Comment posted by Dick Norman on Thursday, September 1, 2011 9:18 AM
Excellent post, but weak on step 15.  
Comment posted by Aralele on Monday, January 30, 2012 9:39 AM
if i want to adjust cutom check-in at the idea?
i mean - i have created a custom check in policy, and i want to edit its UI in a similar idea to this example.
i want my policy to check values from the Global list as well.
1. Does a custom check-in IS A Workitem?- if so i can use this articale idea and config it.


regards

Aralele
Comment posted by Colin Smith on Friday, April 27, 2012 2:51 AM
Good article.  If someone changes a WIT, how can you find out who changed it, and when?  TFS seems to audit everything, but I can't find out the answer to this one question.
Comment posted by Subodh Sohoni on Thursday, May 3, 2012 5:00 AM
Hi Colin,
You are right, it cannot be found out. Basically the permission to change WIT is with the TFS Admin and TPC Admin. No one else can change that so auditing it may not be required but still should be there. I will put it as a product request to Microsoft for the future version.
Comment posted by Venkat on Tuesday, June 5, 2012 6:08 AM
Good Article for a beginner. Thanks a lot.
Comment posted by Venkat on Tuesday, June 5, 2012 6:22 AM
Hi Subodh,

Can you just tell me how to create custom work item template for urban turtle like "Microsoft Visual Studio Scrum 1.0" .If you have any posts on this kindly redirect us.

Thanks in advance.

Regards,
Venkat
Comment posted by Subodh Sohoni on Tuesday, June 5, 2012 12:11 PM
Hi Venkat,
To create functionality similar to Urban Turtle, it is not sufficient to create a process template only. It requires a complete application development.
I suggest you to use next version of TFS (TFS 2012 that is in RC phase). It has this functionality of Task Boards built in. You can download it from MSDN.
Comment posted by Venkat on Wednesday, June 6, 2012 3:34 AM
Thanks Subodh for the info.
Comment posted by Venkat on Friday, June 8, 2012 1:53 AM
Thanks Subodh for the info.
Comment posted by Venkat on Sunday, June 10, 2012 11:54 PM
Thanks Subodh for the info.
Comment posted by CG on Monday, October 22, 2012 5:43 PM
Does step 15 work in TFS 2012? When I drag n drop on Under Investigation it does not provide a transition. Please advise

Regards,
CG
Comment posted by Sandeep on Monday, July 1, 2013 4:45 AM
Thanks a lot. The article was helpful. Keep up the good work.
Comment posted by Arasu on Monday, July 1, 2013 9:19 AM
Thanks help me lot. I have a question is there any possiblity to show subvalues for the global list.I mean to say parent child selection values with the global list?
Comment posted by Sandeep on Tuesday, July 2, 2013 4:11 AM
Hey. Can any one tell us how to add rules. Say i have three work item fields. What i want is, i want the sum of two fields to be displayed in another fields.Please Help.
Comment posted by Amy on Thursday, July 4, 2013 5:56 AM
Hello Subodh,

Any idea what are the points to be takencare when I get a request to customize the template? and what has to be done to get a new attribute which is added in the temlate to come in the reports?

Please help
Comment posted by Jimmy CGI Bangalore on Thursday, July 18, 2013 4:39 AM
Very useful article. Many Thanks.
Comment posted by Mayuresh Sawardekar on Wednesday, March 19, 2014 1:01 PM
I have a situation where I need to provide a template in the "SystemInfo" tab of the work item when the user click in that area. And upon save save the data under the user's login name.
Comment posted by Subodh Sohoni on Friday, March 21, 2014 10:41 PM
Hi Mayuresh,
SystemInfo is a tab with special purpose in Bug work item type. That is used to provide the detected environment info to the developer.
You can create an additional tab of your own and provide the controls there to collect any data from user. Take care to create fields to store that data beforehand.
When the work item is submitted, you can run the WorkItemChangedEvent event handler to store those field values wherever you need to.

Post your comment
Name:  
E-mail: (Will not be displayed)
Comment:
Insert Cancel