Browse DevX
Sign up for e-mail newsletters from DevX


Have it Your Way: Customizing Work Items in Team Foundation Server : Page 4

Find out how to customize Team Foundation Server's process templates, altering work items to suit your team's needs.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Example: Making a Field Required
At this point, you are no doubt beginning to see how you could modify work items to satisfy your group's development process needs. In working with the bug work item, I noticed that the Description field is not required, so I'll show you how to modify the template slightly to demonstrate how to require users to populate the Description field when creating a bug. This is a very simple task. Find the field definition for Description in the type definition. It should appear similar to the line below.

<FIELD name="Description" refname="System.Description" type="PlainText"> </FIELD>

Modify the file to match the example below.

<FIELD name="Description" refname="System.Description" type="PlainText"> <REQUIRED/> </FIELD>

Adding the Required element to the field's type definition forces users to fill in the Description field before a bug can be saved.

Add a Field to the Form
Another useful feature that could be added to the bug work item is a "Found By" field indicating who found the bug. To make this change, you need to add a new field and indicate where Visual Studio should place the field on the work item form.

To add a field to the work item definition, insert the following XML text directly below the field definition for the Description field.

<FIELD name="Found By" refname="DevX.FoundBy" type="String"> <REQUIRED/> <HELPTEXT>Who found the bug?</HELPTEXT> <ALLOWEDVALUES> <LISTITEM value="Customer"/> <LISTITEM value="Tester"/> <LISTITEM value="Developer"/> <LISTITEM value="Other"/> </ALLOWEDVALUES> <DEFAULT from="value" value="Tester"/> </FIELD>

The new field definition adds a required field named "Found By," and provides a list of allowed values: Customer, Tester, Developer, and Other. Tester is the default value for the field.

To finish up, you need to specify where Visual Studio should place the field on the work item form. In this case, put it in the General section under the Details tab. The highlighted code below shows where to place the Control element required to add the Found By field to the form.

<Tab Label="Details"> <Group> <Column PercentWidth="50"> <Group Label="General"> <Column PercentWidth="100"> <Control Type="FieldControl" FieldName="Microsoft.VSTS.Common.Issue" Label="Iss&ue:" LabelPosition="Left"/> <Control Type="FieldControl" FieldName="DevX.FoundBy" Label="Found By:" LabelPosition="Left"/> <Control Type="FieldControl" FieldName="Microsoft.VSTS.Build.FoundIn" Label="&Found in build:" LabelPosition="Left"/> <Control Type="FieldControl" FieldName="Microsoft.VSTS.Build.IntegrationBuild" Label="Resolved in &build:" LabelPosition="Left"/> </Column> </Group> </Column> <Column PercentWidth="50"> <Group Label="Test"> <Column PercentWidth="100"> <Control Type="FieldControl" FieldName="Microsoft.VSTS.Test.TestName" Label="&Name:" LabelPosition="Left"/> <Control Type="FieldControl" FieldName="Microsoft.VSTS.Test.TestId" Label="I&d:" LabelPosition="Left"/> <Control Type="FieldControl" FieldName="Microsoft.VSTS.Test.TestPath" Label="&Path:" LabelPosition="Left"/> </Column> </Group> </Column> </Group> </Tab>

Thanks for your registration, follow us on our social networks to keep up-to-date