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

Posted by: Subodh Sohoni , on 8/26/2011, in Category VSTS & TFS (Azure DevOps)
Views: 123348
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.

This article has been editorially reviewed by Suprotim Agarwal.

Absolutely Awesome Book on C# and .NET

C# and .NET have been around for a very long time, but their constant growth means there’s always more to learn.

We at DotNetCurry are very excited to announce The Absolutely Awesome Book on C# and .NET. This is a 500 pages concise technical eBook available in PDF, ePub (iPad), and Mobi (Kindle).

Organized around concepts, this Book aims to provide a concise, yet solid foundation in C# and .NET, covering C# 6.0, C# 7.0 and .NET Core, with chapters on the latest .NET Core 3.0, .NET Standard and C# 8.0 (final release) too. Use these concepts to deepen your existing knowledge of C# and .NET, to have a solid grasp of the latest in C# and .NET OR to crack your next .NET Interview.

Click here to Explore the Table of Contents or Download Sample Chapters!

What Others Are Reading!
Was this article worth reading? Share it with fellow developers too. Thanks!
Share on LinkedIn
Share on Google+

Author

Subodh is a Trainer and consultant on Azure DevOps and Scrum. He has an experience of over 33 years in team management, training, consulting, sales, production, software development and deployment. He is an engineer from Pune University and has done his post-graduation from IIT, Madras. He is a Microsoft Most Valuable Professional (MVP) - Developer Technologies (Azure DevOps), Microsoft Certified Trainer (MCT), Microsoft Certified Azure DevOps Engineer Expert, Professional Scrum Developer and Professional Scrum Master (II). He has conducted more than 300 corporate trainings on Microsoft technologies in India, USA, Malaysia, Australia, New Zealand, Singapore, UAE, Philippines and Sri Lanka. He has also completed over 50 consulting assignments - some of which included entire Azure DevOps implementation for the organizations.

He has authored more than 85 tutorials on Azure DevOps, Scrum, TFS and VS ALM which are published on www.dotnetcurry.com.Subodh is a regular speaker at Microsoft events including Partner Leadership Conclave.You can connect with him on LinkedIn .


Page copy protected against web site content infringement 	by Copyscape




Feedback - Leave us some adulation, criticism and everything in between!
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.
Comment posted by Somesh Bhardwaj on Thursday, July 24, 2014 10:37 AM
Hi, I wanted to change Text type of description field in Task WI from Plain Text to HTML, but it is not allowing while saving it.
Comment posted by Subodh Sohoni on Wednesday, August 27, 2014 6:08 AM
Hi Somesh,
I am very sorry for the delay in reply.
There are two types of fields which we are not allowed to customize. First are those for which the RefName begins with System and others that begin with Microsoft. We can customize type of any other fields or can create new ones. Description is System field so cannot change type.
Comment posted by Subodh Sohoni on Wednesday, August 27, 2014 6:08 AM
Hi Somesh,
I am very sorry for the delay in reply.
There are two types of fields which we are not allowed to customize. First are those for which the RefName begins with System and others that begin with Microsoft. We can customize type of any other fields or can create new ones. Description is System field so cannot change type.
Comment posted by Balaji on Monday, September 8, 2014 1:47 AM
Created the custom filed called " COmments"  with string data type.So it is allowing only  3 lines.  We need more lines for custom comments filed. I f I change the date type from String to HTMI. I am getting error. Is there any way to increase the length of field or change the data type?
Comment posted by Eshwar on Friday, November 14, 2014 5:29 AM
Do we have an option of exporting listfield which was accidentally deleted?

Please reply its a critical issue.
Comment posted by Subodh Sohoni on Tuesday, November 18, 2014 5:30 AM
Hi Eashwar,

Can you please send more details of the issue?
If you have the original xml of the work item type definition then you should be able to rebuild that even if a field is deleted.