So, you have a field which you want to make required when the state of a work item changes to a given value. How do you do it? Well, I had to do it for a customer recently and forgot how difficult it can be so I thought I’d blog it. Be aware that there are probably multiple ways to do this but I’m going to give you what I think is the most logical way to do it!
You’ll need the TFS Power Tools to do it the way I’m describing it (that’s the easiest way) – hopefully I’ll get around to adding screenshots later on.
Select the work item you want to edit and go to the Workflow tab. Select the state (outlined in red) and do the following:
- Right-click and select Open Details
- Add the Ref Name for the field you want to make required for the selected state
- Open this row and select the Rules tab
- Add the WHEN condition (this is the part that just isn’t intuitive)
- Set the field (maybe System.Reason since that’s tied to the state change) and set the value the field needs to be in order for the field you want to be required to be required (read it slowly – it’s confusing)
- On the Rules tab add the Required condition (don’t need to fill in the For or Not values)