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?
1 Answer
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>