I regularly get asked if there is any way to prevent users creating certain types of work item in TFS – the most common scenario being stopping people who are using the work item only view from creating anything other than bugs.

TFS still doesn’t let me hide blocked work item types from the users in the first place, but I can at least prevent users creating new work items of a certain type, which is a nice workaround.

Here’s how:

1. If you haven’t done so install the latest Team Foundation Power Tools for your appropriate TFS version.  If you are on TFS 2010 you’ll want the TFS 2010 September release.

2. Start Visual Studio and use the Process Editor to open the work item type you want to edit
image

3. Go to the workflow definition for the work item type and find the initial transition – it will be the one where the workflow moves from a blank state to an initial state:
image

4. Double click the transition and in the properties locate the Transition Detail tab and the “Not” field. This field is used to exclude users or groups from being able to use this transition, so set the value as appropriate.  In the example I am excluding a dummy user from a local VM I have.
image

5. Publish the work item type back to your TFS server and refresh team explorer to pick up the changes.

Done!

Let’s check it.  Connect as a blocked user and try and create a work item – in my example I excluded my dummy user from bugs.  Initially I see that I need to supply the Title, just as I had to before:

image

However, once I supply a title I now see the following:

image

Notice that now the State field is showing as required, but I am now unable to set the state to a valid value which effectively prevents me creating the work item type.

Hopefully that helps.