User defined field in wit of tfs - tfs

In tfs for a work item type: can I define a user defined field common to all work item types in the collection?

Yes & No.
Yes
When you define a field in a WIT, for example <FIELD name="My Field" refname="Company.MyField" ... /> you add that field to the collection.
You can see the fields in your collection by running:
witadmin listfieldfs /collection:http://tfs-server:8080/tfs/MyCollection
Any queries or reports you write or run against this collection can see this field. It appears in the Tfs_Warehouse database against your collection also.
No
You will have to add the field (the XML snippet above) to each work item type that you want to be able to store data against. If you are accessing it via the API, Excel, or something other than the work item then that is all you need.
Global List
You can share lists for the fields (such as a list of the teams for a "Team Detected By" field - for example) by creating a Global List.

Related

TFS 2015: default value for old workitems

TFS 2015.2.1. I have a workitem with custum fields. I have seen that if I set a default value (a new rule for the template) this does not auto-populate pre-existing records.
While new records get the default value, the existing records remain with no value in the new field: if I open the workitem I can see the field
with the default value populated (also with old records) but this value is saved only when you save the workitem.
You can see this with a query: if you search workitems with "the default value" you will find only new workitems or old workitems re-opened and re-saved.
Is it possible to save a default value in old records?
I've tested in TFS 2015.3, when apply a default value with DEFAULT rule to a custom field like the example below, the pre-existing records also has this value:
<FieldDefinition name="version" refname="version.version" type="String">
<DEFAULT from="value" value="1.0" />
</FieldDefinition>
You may upgrade your TFS to TFS 2015.3, and set a similar rule as my example, your pre-existing records should have the default value too.
I've had this "issue" in the past, and your observations are right. Changing rules on a field in the work item template won't affect existing records until you open and save them. Therefore, you'll have to update existing records to populate your new fields with their respective default value.
You may use Excel to mass-edit the existing records and achieve your goal.
TL;DR; I have has this problem before and created a tool to bulk edit work items and fill out the values
1-1000 Work Items
Just use the Web Access bulk edit. Multi select in the web, right click, and select Edit.
1000-10,000 Work Items
Create a Query and then Open Excel and connect to TFS/VSTS and open the query. Bulk edit from here and publish.
10,000+ Work Items
Us the VSTS Sync Migration (https://marketplace.visualstudio.com/items?itemName=nkdagility.vsts-sync-migration) tools to bulk edit one or more fields in any number of work items. Use the "UpdateWorkItem" processor with as many "Field Mapps" to make the changes that you need.
Note: There are some inaccuracies in the documentation but if you install with Chocolatey you can use "vstssyncmigrator init" from anywhere.

How can I create a TFS rule on the AssignedTo field that displays a list of valid users and allows freetext entry?

What I am trying to do:
Set up a TFS work item to allow assigning tasks to people who don't have TFS accounts. Those users wouldn't access TFS. We just want to keep track of we assigned tasks to when those people are outside of our team.
What I have tried:
Basically I want to update the AssignedTo field on a task work item to allow entering values that aren't in the list, but still show a dropdown of valid AD users to pick from.
Replacing the ValidUsers rule with a SuggestedValues rule solves the problem of letting us add values that aren't in the list but we lose the dropdown of TFS users unless we manually type each person into a global list (which I'd prefer not to have to maintain).
Using both a ValidUsers rule and a SuggestedValues rule lets you use the dropdown AND type in a new value, but if the typed value isn't in the list it won't validate.
The Question
Is there a way to set up a SuggestedValues rule that pulls the suggested values from an AD or TFS group? Or perhaps there is another way of skinning this cat?
Yes, you can populate the SuggestedValues with a AD Security group or a TFS group with:
<ListRule expanditems="true">
<LISTITEM value="[Project]\Contributors" />
<LISTITEM value="[Project]\Project Administrators" />
<LISTITEM value="Domain\GroupName" />
</ListRule>

"[Me]" variable for custom field alerts in TFS 2013

I added a custom field (Test Prime) in TFS. Since I wanted a drop down of valid TFS users, I copied the setup of the Assigned To control (String, Dimension, ALLOWEXISTINGVALUE, VALIDUSER, and SYNCNAMECHANGES). I want to be able to set up an alert triggered when:
Test Prime Changes to [Me] or Test Prime Changes from [Me]
but "[Me]" or "#Me" does not seem to grab the current user. It's under the drop down menu of Assigned To so I don't see why I can't get access to this variable. Is it because this is for a non-core field and [Me] is only available for core fields? If yes, is there a workaround because I haven't been able to find any.
set the syncnamechanges="true" in the custom field definition. If the workitem template cannot be uploaded, use the witadmin tool to update the syncnamechanges attribute.
in the alert rule, use ##MyDisplayName## placeholder instead of [Me] or #Me.

Sharepoint Make a custom list read only

I have created a custom list. I am using the same list in sharepoint designer through a page.
I a have a datetime field in the form. I want to make a default current date and time and let it make readonly.
How can I do the same.
thanks
As I understood you, you want to set custom permissions on a date field (column) in a custom list. Sharepoint 2007 does not allow column-level security via the UI as far as I know.
If you deployed the list definition via Feature you can set the site columns to be read-only by setting the field to read only via its column definitions like so:
Hidden="FALSE" ReadOnly="TRUE" Required="FALSE" PITarget="" PrimaryPITarget="" PIAttribute="" PrimaryPIAttribute="" Node=""
An easier solution is to use third party tools such as the Sharepoint Tool Basket. It has a feature called "List Manager" which allows you to set columns to read-only if it's not a system column - see the codeplex site for screenshots.
As for your datetime field having the date of Today, you can just create a new Site Column of type Date/Time and set its default value to be "Today".
So the easiest solution would be: Install the List Manager and activate the feature for your site. Create a new site column "Today" of type Date/Time with default value set to Today. Afterwards set the site column to read-only via the List Manager.

Rename work item type fails

In TFS2010/TFSPowerTools2010/Process Explorer I am creating a custom process template. I define a new work item type (WIT) called "Enhancement" copied from the CMMI "Change Request" WIT.
Then I want to rename the friendly field name of the work item type "System.Title" (called "Title") to "Summary".
When I upload my custom process template to the TFS server and create a team project, and then create a new Enhancement, the info in the required field text still shows :
"TF20012: Field "Title" cannot be empty.
Why ?
(I want to see "TF20012: Field "Summary" cannot be empty.)
What you can do is create a new field and make it required. Call it Summary, etc. Change the Title label and textbox from the stock values and point it to your new field. Do not remove the System.Title field from the field list.
In the work flow, use the Summary value to populate the System.Title field, which is not on the form. Then if they try to save without a Summary, they will get the correct error and System.Title will have a valid value for reporting.
Be sure you account for the System.Title field everywhere it is referenced in the work flow.
You aren't able to rename a system field like System.Title. It's used by other work item types across the team project collection and the server instance. It also has to be filled in by the default rules. You can rename the "label" that gets shown to the end user by going to the layout tab of the work item type editor (in the TFS Power Tools) and find the control and change it's label attribute but leave the field the same.
In Visual Studio I was looking at a WinForm and saving the form I got this error:
Microsoft Visual Studio Save failed.
TF20012: Field 'Title' cannot be empty.
OK
Since its a TF error I closed all the Work Items (even unsaved ones...) and then saving the Winform worked.
I am not sure how VS thought the Work Item was the active code window I saw looking at.

Resources