TFS "Assign To" is showing too many users - tfs

I am connected to a TFS server, and when I create a work item (Bug, Task, etc.), the "Assign To" shows WAY too many users. I cannot find a way to limit the users shown that will affect anyone else who connects to the server.
For example, I have under the "Assign To" dropdown:
Administrator
LOCALE SERVICE
User 1
User 2
User 3
User 4
User 5
I want the "Assign To" dropdown to only show:
User 1
User 3
User 5
How would I do this, so that it changes on the server, and if anyone new connects to the server, they can only see the three users on the "Assign To" dropdown?

Here's what you should do:
Open the Visual Studio Command Prompt. This will give you a command line window with the PATH set to run VS / TFS tools
Download the Work Item Type definition that you want to modify (e.g. Bug, Task):
witadmin exportwitd /collection:collectionurl /p:project /n:typename [/f:filename]
This will give you the WIT's definition, in XML format.
Open the XML file. You will edit the rules for the Assigned To field. Find the term "System.AssignedTo"
In the Allowed Values rule element, modify (or add if none exists) your List Item element to limit the values to members of one (or more) TFS / Active Directory group(s).
Your field definition should look like this:
<FIELD name="Assigned To" refname="System.AssignedTo" type="String" syncnamechanges="true" reportable="dimension">
<HELPTEXT>The person currently working on this bug</HELPTEXT>
<ALLOWEXISTINGVALUE />
<ALLOWEDVALUES expanditems="true" filteritems="excludegroups">
<!-- Below is a TFS group. Note you actually type "[project]" verbatim -->
<LISTITEM value="[project]\Contributors" />
<!-- Below is an AD group. The name and group are examples only -->
<LISTITEM value="MYDOMAIN\Developers" />
</ALLOWEDVALUES>
</FIELD>
Importing your changes:
Save your file.
In the command line window type the following:
witadmin importwitd /collection:collectionurl /p:project /f:filename
That's it. Your work item type is now limited to the people you want.

See my answer here for 2012, it may be similar: Visual Studio - Don't display all domain users in "Assign To" field
The problem was that [TEAM FOUNDATION]\Valid Users included
[TEAM FOUNDATION]\Team Foundation Administrators which included [BUILT IN]\Administrators
In the TFS Server Administration Console I selected Application
Tier and clicked Group Membership. I then double-clicked on
[TEAM FOUNDATION]\Team Foundation Administrators and removed [BUILT IN]\Administrators.
Now I only see my team and not all the SQL admins and engineers that
were local admins on the server. All without any command line or
addons.

You can:
1) go here https://teamprojectmanager.codeplex.com/releases and download the latest Team Project Manager;
2) launch it (an *.exe file in the archive);
3) connect it to your project;
4) go to "work item configuration" on the right;
5) then to "work item types";
6) select your item type (Product Backlog Item for instance), click "edit";
7) do what Assaf Stone suggested above, in my case it was just replacing
<VALIDUSER />
with
<ALLOWEDVALUES expanditems="true" filteritems="excludegroups">
<LISTITEM value="[project]\Contributors" />
</ALLOWEDVALUES>
8) save your changes;
That's it! BTW, the tool can come in handy for some other customizations as well.

After installing TFS power tools for Visual Studio.
From the menu open Tools --> Process Editor --> Work Item Types --> Open WIT (WorkItem) Type from Server.
Select the Collection and the Project and The Work Item that you need to make changes to.
Open the Assigned To field and Click on Rules Tab
Edit the Valid user an add the "group name" which you wanted to display.
Then save the Workitem by selection save in Visual Studio.
Hope this works.

Create a seperate group under the collection and add the users.
Open the Process template Add a rule to assigned to field Assigned to "Valid User" and select the Group which you created.

So after looking at a few keywords from hems I got some good google results.
The first thing you need to do is go into visual studio, and select team menu and from there go to collection settings. You will see process template and from there you can download one you have.
After you download it you can then modify any settings you want. When you are done, go to the same menu and this time click upload.
That is all it takes, but note you can only select this new one on project creation.

Related

Adding new "tab" to a bug work item in TFS 2017

I am trying to add a new "tab" to bug item in TFS 2017. Looking at the "tabs" you see things like "Steps to Reproduce", System, etc.
I have found information on changing work item types but nothing about adding a new "tab" across the top where you see Steps to Repro, System, Test Cases, Tasks. The change I want to make may not be possible? Or it is possible I don't know the correct verbiage to use when asking google. The think I want to change may not be a tab control at all it maybe something else different.
Thanks
***************** Updated questions after posting *****************************
After playing around with Process Editor -> WIT -> Open WIT from server -> Bug
as suggested by Andy Li-MSFT I don't see a lot of control on the formatting on the tab. I was planning to add fields in a grid like pattern like a table as shown below. I am able to get the values in the drop down list for field1 and add the fields. However I have a couple follow up questions if you have time.
Setting either the control or column for the control to read-only the column will not render when adding a new bug. I have a little more control if I set AllowedValues and Frozen for the column however the value can still be changed. Is there a better way to set read-only?
There is not much control on the layout. I am OK adding a lot of fields but would like them to be displayed in a table like structure. Is there a way to control the look of the fields on the form?
Is there a way to add the fields in a grid? This would be ideal so I only have one header for each column.
The last-updated-by and last-updated-date. Is it possible to track on a row level who made a change? If not I would be OK just adding a last updated by and last updated date to the new tab. Row level updates would be nice.
<pre>
Field 1 Field 2 (Read-only) Field 3 Last Updated By Last updated Date
Status (completed, empty, N/A) "Some text here which describes something to do" "Optional comments" tfs user name date/time
Status (completed, empty, N/A) "Some text here which describes something to do" "Optional comments" tfs user name date/time
</pre>
You need to modify the WIT definition file (Bug work item type in your scenario).
You can try below ways to do that:
Export the WIT definition file with witadmin commands, add a new tab under <TabGroup> and add a new control for it, then save and import the file. See Import, export, and manage work item types for details.
e.g:
<Tab Label="Tab0501">
<Control FieldName="System.ChangedDate" Type="DateTimeControl" Label="Test0501:" LabelPosition="Left" />
</Tab>
You can also use the TFS Power Tools to export/import WIT definition files or directly modify the files from server:
Visual Studio 2015 : Microsoft Visual Studio Team Foundation Server
2015 Power Tools
Visual Studio 2017 : TFS Process Template Editor
Reference below screenshot to do that.
Another way is writing an extension to Extend the work item form, you can reference my answer in another thread to do that.

Original Estimates in TFS Scrum projects (TFS 2017)

When creating a task in a TFS project that was created using the Agile template there is an option to enter an original estimate (See image a).
When creating a task in a project that was created using the Scrum template there is not option to enter original estimate at the task level.
Is there a way to add or turn on this feature. We use the Fibonacci effort sequence at the PBI/User Story level and make use of velocity, but we need to use original estimates at the task level for accounting purposes.
Reference img a:
Original Estimate (Microsoft.VSTS.Scheduling.OriginalEstimate) field exists in Agile and CMMI process template by default. You need to update the Task work item type definition in Scrum process template and add that custom field yourself:
Use witadmin tool to export the Task work item from the team project you want to customize:
witadmin exportwitd /collection:http://TFS2017:8080/tfs/DefaultCollection /p:ScrumProject /n:task /f:task.xml
Add the custom field between <FIELDS> </FIELDS>:
<FIELD name="Original Estimate" refname="Microsoft.VSTS.Scheduling.OriginalEstimate" type="Double" reportable="measure" formula="sum" />
Add a section between <Page Label="Details" LayoutMode="FirstColumnWide"> </Page>:
<Section>
<Group Label="Effort">
<Control Label="Original Estimate" Type="FieldControl" FieldName="Microsoft.VSTS.Scheduling.OriginalEstimate" />
</Group>
</Section>
Import the work item type:
witadmin importwitd /collection:http://TFS2017:8080/tfs/DefaultCollection /p:ScrumProject /f:task.xml
Then you'll see Original Estimate field:
You may download TFS Process Template Editor and edit work item type definition:
Open on VS 2017 Process Editor->Work Item Types->Open WIT from server.
Find your scrum project and work item type Task.
Add Original Estimate field to fields section:
Name=Original Estimate
Reference name=Microsoft.VSTS.Scheduling.OriginalEstimate
Data type=Double
Add new field to layout section.
You may find a sample in agile or cmmi project.

Test Case WIT in TFS2012 giving error - Microsoft.TeamFoundation.TestManagement.Client.InvalidWorkItemTypeException

I am trying to add/import a new work item type "Test Case" (exported from MSF for agile ver 6.2 process template) into one of our existing team project based on MSF Agile 4.2 process template. I am able to import the WIT using power tools successfully. But when I try to create a new work item in team project using this Test Case template, I get the following error in tabs 'Steps' and 'Associated Automation':
*Microsoft.TeamFoundation.TestManagement.Client.InvalidWorkItemTypeException: The following work item type is not valid: Test Case. You must specify a valid work item type that belongs to a category with reference name Microsoft.TestCaseCategory or Microsoft.SharedStepCategory.
at Microsoft.TeamFoundation.TestManagement.Client.TestManagementTeamProject.CreateFromWorkItem(WorkItem workItem)
at Microsoft.TeamFoundation.TestManagement.Controls.TestStepsPart.GetTestBase(WorkItem workItem)
at Microsoft.TeamFoundation.TestManagement.Controls.TestStepsPart.get_TestBase()
at Microsoft.TeamFoundation.TestManagement.Controls.TestStepsPart.set_WorkItemDatasource(Object value)
at Microsoft.TeamFoundation.TestManagement.Controls.BasicWorkitemCustomControl.set_WorkItemDatasource(Object value)
at Microsoft.TeamFoundation.WorkItemTracking.WpfControls.CustomContentControl.set_WorkItemDatasource(Object value)
at Microsoft.TeamFoundation.WorkItemTracking.WpfControls.WorkItemControl.ControlFactory_ControlCreated(Object sender, ControlCreatedEventArgs e)
at Microsoft.TeamFoundation.WorkItemTracking.WpfControls.WpfControlFactory.OnControlCreated(ControlCreatedEventArgs args)
at Microsoft.TeamFoundation.WorkItemTracking.WpfControls.WpfControlFactory.CreateControl(String fieldName, String preferredControlType, String fallbackControlType, StringDictionary properties)
at Microsoft.TeamFoundation.WorkItemTracking.WpfControls.WpfFormRenderer.CreateControl(FormElement element)
at Microsoft.TeamFoundation.WorkItemTracking.WpfControls.WpfFormRenderer.RenderCollection(Grid panel, FormElementCollection collection, Int32& currentCol)*
Any idea how to resolve this? Thanks in advance.
By defining a default work item type for a category, you can help use the correct field population when you work in other Team Foundation clients, such as Microsoft Test Manager. By selecting the default work item defined for a category, many other fields can be auto-populated with default contents.
You modify the categories defined for a team project by modifying the XML definition file for its categories.
I updated the WIT category (given below) and imported the same (using witadmin importcategories command) to my team project. It solved the WI error!
<CATEGORY name="Test Case Category" refname="Microsoft.TestCaseCategory">
<DEFAULTWORKITEMTYPE name="Test Case" />
</CATEGORY>
I want to clarify Jimmy's answer. After you have created a new WIT template, identify the name that you have assigned to the template. If you are using VS Power Tools, the name you need is the Name entry box in the Work Item Type viewer. If you have an xml file with the template, the name id /Witd:WITD/WORKITEMTYPE/#name.(For this answer, we will assume a name of "My Custom Test Case") You must now retrieve the category file to add your new template. Do this with the witadmin exportcategories command (e.g. witadmin exportcategories /collection:"http: //tfsServerName:port/tfs/collectionPath" /p:project /f:Collections.xml which saves the collections file to the directory you run the command from). Once you have exported the collections file, find the category you would like to add your template to or create a new category. Next add a WORKITEMTYPE with an attribute name and a value of the template name. Below you can see the value for a custom test case that has been added to the TestCaseCategory:
After the necessary modifications, save the Collections.xml file and import it back into the server using witadmin importcategories (e.g. witadmin importcategories /collection:"http: //tfsServerName:port/tfs/collectionPath" /p:project /f:Collections.xml)
You should now be able to use the template you created to create new workitems.

Is it possible to recover a task in TFS that's had the status set to Removed?

If someone accidentally set the status of a task to "Removed" in TFS 2010, is there any way to recover it?
If you just changed the Status/State to Removed you should be able to create a new Query and search for Removed work items.
Go to My Queries, right click -> New Query, adjust the last item to State = Removed and click Run
From the query results you can open up the task and change the Status/State to the appropriate Status/State
this assumes that your work item type definition allows for the state to go back to something other than removed
Edit
If you want to alter the behavior for a Task in the default scrum template you must modify the Task.xml located under
C:\Program Files (x86)\Microsoft\Microsoft Visual Studio Scrum 1.0\Process Template\WorkItem Tracking\TypeDefinitions
Open the file and add in an additional <TRANSITION/> element located under <TRANSITIONS/>
<TRANSITION from="Removed" to="To Do">
<REASONS>
<DEFAULTREASON value="Added back into the backlog" />
</REASONS>
</TRANSITION>
Save the file and update the modified Task work item type definition using TFS Power Tools. This will overwrite the Scrum Task type and introduce the newly transition from Removed to To Do
From there you simply need to run a query to find your Removed task and change the State.
You can also duplicate the work item to create a complete copy of this item in the To Do state. This is a bit of a work around, but is simpler and quicker to do. You can do this by:
Open the work item.
Click Tools on the menu.
Choose "Create Copy of Work Item"

Team Foundation Server -> Microsoft Project integration

I am hoping someone here can shed light on my problem. I am trying to integrate TFS work items and MS Project. What field is mapped from the work item into the duration column of Project? I can change the way I am doing this, but, I had created a custom field Work Item field in TFS. I have the mapping file that TFS uses to map to Project. Here is my Work Item definition:
<FIELD name="EstCodingHours" refname="CustomFields.EstCodingHours" type="Double"
reportable="detail">
<HELPTEXT>Enter estimated number of hours to fix bug</HELPTEXT>
</FIELD>
Here is my mapping definition:
<Mapping WorkItemTrackingFieldReferenceName="CustomFields.EstCodingHours"
ProjectField="pjTaskDuration" ProjectUnits="pjHour" />
I can map to other fields such as pjTaskDuration1. Is pjTaskDuration read only perhaps? If I can figure out what maps into pjTaskDuration, I can use it instead of my new field EstCodingHours.
Thanks,
Scott
The TFS out-of-the-box templates don't map the duration field by default.
Wes Macdonald steps through the process of doing such a mapping in a blog post.

Resources