TFS Tip: Making a field READONLY after the work item has changed states

Ever need to make a field read-only to everyone except for a specified group, but only once the work item has made it past a specific state?

You could achieve this by marking a field as read-only when it gets to a specified state. So after you enter the initial information, you move your work item to a state of Active (or you can use any other state), and within that state definition add a field rule to make it readonly. In the following sample, i’m making description readonly when the workitem is in the active state. Note that it is readonly for everyone, except for project administrators:

    <STATE value="Active">
      <FIELD refname="Microsoft.VSTS.Common.ClosedDate">
       <EMPTY />
      <FIELD refname="Microsoft.VSTS.Common.ClosedBy">
       <EMPTY />
      <FIELD refname="System.AssignedTo">
       <REQUIRED />
      <FIELD refname="System.Description">
       <READONLY not="[Project]\Project Administrators" />

You would have to apply the same rule to all the states in your work item that should have this rule.

About esteban

Esteban is the Founder and Chief Technologist at Nebbia Technology, an ALM consulting and Azure-powered technology company. He is a software developer with a passion for ALM, TFS, Azure, and software development best practices. Esteban is a Microsoft Visual Studio ALM MVP and ALM Ranger, Pluralsight author, and the president of ONETUG (Orlando .NET User Group).

Leave a Reply

Your email address will not be published. Required fields are marked *

Are you human? *