Changing TFS Field Types
-
Tuesday, June 13, 2006 11:10 PMWhile I've read this article regarding field utilities http://msdn2.microsoft.com/en-us/library/ms400725.aspx, is there any way to change the type of a field (witimport suggests no change once set)? The 'String' type actually limits the length to something too short to meet our new needs and, while the 'HTML' type is sufficient, we would like to preserve the 2000+ odd work items that we have with values in this field already. Any info would be appreciated.
All Replies
-
Wednesday, June 14, 2006 7:06 AM
Yes, the only way to change a field type is modifying its template, download it to your computer with the Team Explorer or with witexport, modify the Xml definition, by hand, or better with the gotDotNet tool called Process Template editor, and then import again the modified template into Team Foundation.
But, the projects created with the template before this modifications, won't be affected, it will only affect to newly created projects, of course you won't loos any data on older projects, but you won't have the modified field type also.
-
Wednesday, June 14, 2006 4:29 PM
You can still modify workitem type definitions after a project has been created. There are some problems modifying data elements with new data types but every time I've gotten that was because they were incompatible data types (string -> datetime), but it will let you know in the process and it shouldn't affect your data (a backup beforehand would be prudent anyway). Use the gotdotnet tool, it will allow you to choose the team project and workitem type off the server and then upload it afterwards.
As FYI, the tool just uses the same functionality that witimport and witexport has available
-
Wednesday, June 14, 2006 8:22 PM
Yes, I'm aware of modifying work item templates via witimport/witexport which is where I seem to have the issue. I've declared a field in one of the iterations that was of type="String" and we've been using it fine for a month or so, but now realize that it has a rather short length limit and wanted to change it to something larger like type="HTML" or type="PlainText" (I think that is the name for this one). When I go to import the work item template with this change from the previous value of string to html (I tried plain text as well) OR whether I use the process template tool and try to save, I get this error:
Error: TF26038: Field type for <field> does not match the existing type. It was String, but now is HTML.
Suggesting that I cannot change a field type once it is uploaded?
-
Thursday, June 15, 2006 1:17 AM
Looks like it, sorry. I guess the only other thing I can think of is to add in a new field, hide the old one, and set the workitem type so that it defaults with the old field value. -
Thursday, June 15, 2006 8:24 AMSorry I misunderstood, and yes you cannot change it, you have to do what kayers says I think
-
Thursday, June 15, 2006 8:28 AMyeah, I kind of figured that I would be doing something along those lines to copy the value over to a newly defined field.
-
Thursday, October 15, 2009 1:07 PM
Hi,
A non-recommended workaround to achive this if is a new Field that you've created by mistake is to change the field definition directly in the database
Go to the database TfsWorkItemTracking --> Table Fields --> find your field and change the "Type" and "NewType" columns.
And the run the witImport command
Be careful with this workaround, it may destroy your data, first implement it on Testing, then in Production environment.
Andres Pompiglio- Proposed As Answer by Jakcy Wong Thursday, August 02, 2012 6:45 AM
-
Friday, May 28, 2010 11:33 AM
Field types can be changed using following command (You dont need to execute this command from TFS app server)
witadmin changefield
For example i want to change my field type from reportable to non-reportable
witadmin changefield /collection:"http://<servername>:8080/tfs/Tfs Support" /n:<Field reference name> /reportingtype:none /noprompt
-
Monday, March 14, 2011 4:20 PM
"witadmin changefield" I think can only change whether the field is reportable as a dimenstion etc. or not.
I had to remove the field from the collection (and then readd it again as another type) via: "witadmin deletefield /collection:%CollectionURL% /n:qwertyField"
- Proposed As Answer by timB33 Tuesday, March 15, 2011 10:33 AM
-
Thursday, August 02, 2012 6:48 AM
It works well through change the database . for example:
On sqlserver , the database is tfs_defaultcollection, run the sql as below
update dbo.Fields set Type = '64', NewType = '64' where FldID = '10348';
It will change the filed type to "PlainText"

