Set a default iteration path for a work item type on TFS - tfs

I try to tune my Team Foundation 2005 work items.
We have 5 iterations paths in the "Bug" work item type.
I would like it to default to a specific value, for example Iterations.Iteration2
I tried to add a DEFAULT rule in the work item type editor but couldn't set the iteration path.
How can I do that?

I'm getting the same error with TFS 2010 when I try to set a default rule for a work item type for a default iteration path.
It seems the rules engine for work items unfortunately doesn't allow this (as explained by this post and others I've seen around).

Create a Work Item Template.
If you're using VS, you'll need the Power Tools. If you're using the web interface, the feature is already built-in.

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.

Workflow to apply scripts in homologation/production

I'm using TFS's workitens to DBA's team apply scripts in homologation/production, so, i'm creating a workitem and linking BD's scripts in it. To make sure that nobody will change the script after i created the workitem, the DBAs team is locking the scripts in TFS before aplly. I think there is another tool or method to make it safer and smarter
You can give a try with this workaround by Angela Dugan, In short the solution of Angela works as follows:
Add a field [UserAccessDenied] to a work item but do not show this
on the form In the desired state add a rule [REQUIRED] for a certain
group
Because you can not enter a value, you can never save the work item,
so it is “sort of” read only.
For example, after setting only you in can make a state transition from [Active] to [Resolved]

Why can't I remove my Allowed Values rule from a custom field in a Work Item Template?

We have two customized Work Item Templates (Bug and Product Backlog Item (PBI)) that both contain a custom field (Change Request Number). In both templates we had added a custom ALLOWEDVALUES rule for that field, where we referenced some globallist.
Now we want to remove that restriction - we want it to be freely editable. So I removed the rule from both templates, imported them, and created both a Bug and Product Backlog Item. I then noticed the Bug working as expected (showing a simple textbox), while the PBI still showed the dropdown list containing the globallist values for that field.
I'm sure I imported the templates correctly, as changing stuff like textlabels does get reflected. What might going on here, and how can I fix the PBI templates as well?
Just tried creating a custom field with ALLOWEDVALUES rule in PBI with TFS PowerTools, then removed the rule. The PBI work item worked as expected.
Removing a rule from a field is an easy operation, I'd like to suggest you install TFS PowerTools to double check the PBI. Also, if the issue only exists in VS, try to clean the cache folder C:\Users\username\AppData\Local\Microsoft\Team Foundation\x.0\Cacheto see whether it is helpful.
By the way, my test environment is TFS2015.3 + VS2015.3.
Apparently you can put rules on states and transitions as well. In this case there was the same Allowed Values rule applied on the "New" state in de PBI template. Removing that one solved my problem.

How to remove hours from Scrum 2.0 template

We are currently using Scrum 2.0 process template from microsoft in new TFS 2012, however we don't use hours as task estimates, we simply count tasks. This is easily archieved by setting each task value as 1 as default and set that field read only in task property form.
However original template uses hours as unit with tasks, so there are are mark "h" all around template. Is there way to get rid of this hour mark since it causes constant confusion? Especially in management.
You can configure how the remaining work is displayed, by modifying the format attribute in the following row in the commonconfiguration.xml file:
<TypeField refname="Microsoft.VSTS.Scheduling.RemainingWork" type="RemainingWork" format="{0} h" />
By default this attribute is "{0} h", so you can simply set it to "{0}" to fit your needs.
You can download the commonconfiguration.xml file from the server, using the witadmin command:
witadmin exportcommonprocessconfig /collection:http:<your collection> /p:<your project> /f:<the file name>
After editing the file you must import it back into TFS using witadmin command:
witadmin importcommonprocessconfig ...the same parameters as above
Note: with the RC it looks like you must leave a space after the placeholder, like "{0} ", otherwise you will get a validation error, when importing the file. I haven't tried yet with the RTM to see if this has been fixed.
As far as I can tell, all of those h's are hardcoded straight into web access. So the only way to remove them would be to find them (I used Chrome's dev tools), isolate them, and then go into the Web Access pages located on your TFS Server (application tier) and manually remove them. This is because they aren't actually part of any template, so there isn't a way to remove them all at once. The path to the files will be something like
c:\Program Files\Microsoft Team Foundation Server 11.0\Application Tier\Web Services
Good luck, I've had a heck of a time trying to alter them.
You can use TFPT or the WITADMIN command line tool to remove the remaining effort field.
I would suggest however not to remove it, but rather to remove it from the form itself (so that it just doesn't show), and add a rule so that it defaults to 1 and is read-only. Furthermore, in the workflow, add a rule that changes the value to 0 when you reach done.
Since there's no actual meaning to the number itself, the units can be actual hours, ideal hours, story points or whatever you want them to mean. By making each task 1 or 0 (when done), you can make use of TFS' built in tools such as the burndown reports to track your progress. Each task done will reduce the remaining work, and you will be able to keep track of velocity by summing up the effort completed in each iteration (which is the same as counting).

Get labels applied to a particular version of an item in TFS source control

I'm trying to get a list of labels that apply to a particular version of a particular file in TFS Source Control. So far, I've gotten a set of labels that apply to any version of a particular file. Does anyone have any experience getting labels for a particular item?
For example, I have $/Project/Folder/Item.cs, which was modified in changesets 301, 401, and 601. Labels Build1 - Build 99 exist for the project. Build1 - Build10 were applied before changeset 301 (i.e. before Item.cs was created). Build96 - Build99 were applied to the v601 of Item.cs. If I run
vcServer.QueryLabels(null, "$/Project", null, false, "$/Project/Folder/Item.cs", new ChangesetVersionSpec(6))
I get Build11 - Build99 as results. I haven't figured out how to get a query to return fewer than this many labels. Ideally, the query I run will return 4 labels (Build96 - Build 99).
The context of this question is a TFS Project, with CCNET for a build server. I'm trying to relate work items to builds, starting with a work item number.
Any tips? Or examples of QueryLabels? Or better docs for QueryLabels than the MSDN docs?
This is possible, see here: http://social.msdn.microsoft.com/Forums/en-US/tfsversioncontrol/thread/9f41f37e-4fda-4b56-91a3-f2b7e0c0e22d
Basically, once you get back the list of labels, you have to look through each label and see what changeset of the item you're interested in it applies to. Be sure to pass in the "includeItems = false" flag to QueryLabels, otherwise you'll have to look through every item on the label.
What you are wanting to do should definitely be possible using the API. The answer I gave to the other question was about seeing the labels inline with history in the UI.
For more information about doing what I think you are wanting to do, then take a look at:
Buck Hodges: Finding the changes between two labels in TFS version control
and also
Manish Agarwal: What is GenCheckinNotesUpdateWorkitem task?
Hope that helps.
Martin.
It looks like it's not possible with the current TFS version, but may be with the next.

Resources