azure-devopsbooleantfs-workitemworkitem

Azure Dev Ops: How can I require a boolean field to be true before state can be changed?


I am modifying a workitem using the XML model on Azure Dev Ops server 2022.

I have a short checklist, made up of checkboxes, like

x Independent x Negotible x Valuable x Estimable x Small x Testable

Before the state can be changed to ready, all the checkboxes must be set to true.

How can I write rules for this in the WIT?

I tried to use MATCH and PROHIBITEDVALUES, but these rule elements are not working with booleans.


Solution

  • You may add your custom field for validation purposes:

    <FIELD refname="MyCorp.Validation" name="Custom Validation" type="String">   
           <WHEN field="MyCorp.Independent" value="false">  
               <COPY from="value" value="Independent false">  
           </WHEN>  
    </FIELD>  
    

    Then use it as prohibited values in the state:

    <STATE Your state definition >>>>>>  
        <FIELD refname="MyCorp.Validation">  
            <PROHIBITEDVALUES for="userGroupName" not="userGroupName" expanditems="true | false" filteritems="excludegroups">   
              <LISTITEM value="Independent false" />  
            . . .   
            </PROHIBITEDVALUES>
        <FIELD>