TFS 2010 Transition Validation to Force Field Change

0

I'm using TFS 2010 and I'd like to add a transition validation to state that a field value must be changed. I.e. the value after the transition cannot be the same as the value before the state transition. Reading the docs I can't see how to do that. Any suggestions?

Dave Potts

Posted 2015-01-19T15:59:01.583

Reputation: 235

Questions about tools normally used by programmers should generally be asked on [so] instead. Unfortunately, this question is now too old to migrate, so it'll remain here. – a CVn – 2015-05-29T12:22:50.807

Answers

0

I found the answer by adapting this post: http://blogs.msdn.com/b/teams_wit_tools/archive/2009/02/07/work-item-rules-workarounds-validating-area-path.aspx

Step 1: Set up a hidden field for the validation

<FIELD name="Hidding Validation" refname="DavePotts.HiddenValidation" type="String">
    <HELPTEXT>Hidden validation field</HELPTEXT>
    <PROHIBITEDVALUES expanditems="true">
      <LISTITEM value="This field must be changed on a state transition" />
    </PROHIBITEDVALUES>
    <COPY from="value" value="No Errors" />
</FIELD>

Step 2: Set the transition field constraint to trigger the prohibited value if not changed

<TRANSITION from="initial" to="final">
    <FIELDS>
        <!-- This block forces the DavePotts.FieldYouWantToChange field to be changed in value on transition -->
        <FIELD refname="DavePotts.HiddenValidation">
           <WHENNOTCHANGED field="DavePotts.FieldYouWantToChange">
              <COPY from="value" value="This field must be changed on a state transition" />
           </WHENNOTCHANGED>
        </FIELD>            
    </FIELDS>
</TRANSITION>

Dave Potts

Posted 2015-01-19T15:59:01.583

Reputation: 235