STATE Element of the work type definition in Team Foundation Server

STATE Element is one of the most important elements that can be specified while creating work item type definition. It determines states of the work item throughout its life span.

Here is an example of the STATE element from bug work item type that comes with the default installation of TFS Agile Process Template.
<STATE value="Resolved">
        <FIELD refname="Microsoft.VSTS.Common.ClosedDate"> <EMPTY/> </FIELD>
        <FIELD refname="Microsoft.VSTS.Common.ClosedBy"> <EMPTY/> </FIELD>
        <FIELD refname="Microsoft.VSTS.Common.ResolvedReason">
            <COPY from="field" field="System.Reason"/>

We can see from the above listed XML code that our work item called bug has a state called “Resolved” and several system fields such as ClosedDate, ClosedBy and ResolvedReason.

We should be very careful when setting up elements. For instance, the following state element can cause unexpected errors. The problem with this is that ChangedBy field is editable field and validation may not handle errors properly.
<STATE value=" ">
        <FIELD refname="System.ChangedBy">
            <SERVERDEFAULT from="currentuser" />

In addition, there are several important usages for the State element. State element can be used to define states. See example below for State definition within State element
        <STATE value=" " />
        <STATE value=" " />

Featured pages

SharePoint Integration

Windows SharePoint Services is an integral part of Team Foundation Server. As a result, there is v…

Creating Team Project

Team Foundation Server allows creation of the portal project via TFS Portal Creation Wizard. This …

SQL Server Agent Jobs

Team Foundation Server installs several SQL Server Agent Jobs that allow it to perform certain tas…

tf Command

tf Command line utility provide many useful operations that we can perform with Team Foundation Se…

Shelving and Unshelving

Shelving is very powerful feature of the Source Control in VSTS that allows storing pending change…

MS Project Fields Mapping

TFS works with MS Project via mapping file with specific fields mapped from one application to ano…

Using MS Project with Team Foundation Server

MS Projects allows accessing Team Foundation Server and working with the TFS Work Items. This is a…

Managing Documents in TFS

Team Foundation Server provides us with the capability to manage various documents, also called ar…