Prevent specific users from modifying area and iteration in a Work Item Type

It is not supported to add READONLY or FROZEN rules on the System.IterationPath and System.AreaPath.

A work around is to create a custom field named "You cannot change this field" for example. Give it the Integer type.
In the "Rules" tap, add one WHENCHANGED rule for each field you want to protect.
In the first one, select System.AreaId in the Field Condition, and navigate to the Rules tab.
Add two rules:
  • COPY
    • For: the TFS group containing the users not authorized for change
    • From: value
    • Value: leave empty
    • For: the TFS group containing the users not authorized for change

Do the same for the second WHENCHANGED rule for System.IterationId

Basically, the following sequence will trigger when an unauthorized user tries to change a protect field (System.AreaId and System.IterationId linked respectively to System.AreaPath and System.IterationPath) :
  • The field value is changed to blank
  • The field is set to REQUIRED
This triggers a validation error when the user modifies the Area or Iteration field. The error message is not the best because it says:
     Field 'You cannot change this field' cannot be empty. 

At least it gets the job done :)

Popular posts from this blog

Adding a delay before processing Textbox events

Handling exceptions the right way in WCF (part 2)

Change the deployment URL of a ClickOnce application