How to change a custom attribute type
I created a custom attribute with a type of String, but now wish to
change it to type smallString.
I have tried selecting the attribute and clicking on "Edit..." but the
type is greyed out and cannot be changed.
I also tried removing the attribute and adding it back it, but once
removed, you cannot create a new attribute with the same name.
How can I change a custom attribute's type?
How can I remove -permanently- an attribute that is removed so I can add
it again?
Mark.
Accepted answer
I don't think it is safe to use one of the proposals to modify the process XML. You might run into issues later.
The suggestion is to export the attribute data into CSV, include the work item ID in the export.
Then import data - only using the ID and the column renamed for the new attribute. Choose update existing work items. You might have to figure the mapping out, however, since you just update just the new work item attribute from the data of the old one, into the existing work item, you should not loose anything.
One other answer
Not sure if you have figured this out yet. Through the Process Configuration Source Tab of the Project Area you are able to override the XML values that are stored there to change the type. I have done that with String and Html, and it seems to work fine.
The case that I have not been able to fix is I am trying to change an attribute that is of type Interval to type Enumeration. It works, except for the Editor Presentation still sees the attribute as an Interval, but generates an error stating that the type should be and Enumeration. Except it is not giving the drop down option for the Enumeration.
Comments
You are risking to screw up your database doing this. My suggestion is to keep the old data and migrate it to a new attribute. Renaming the old attribute gets it out of the way.
All I know and all feedback I have seen is, doing what you try to is not a great idea and might cause serious issues in the long run.
If this is an usafe behavior, then why is this information stored in the Configuration File, and why are users given access to that information? Safe programming practices are to not give access to data that can break the system. So how do you guys control data integrity if I have access to it?
Can you expound on what issues it will cause?
How do you rename an attribute that has already been archived?
It is necessary to be able to edit the XML source in special cases, for example
- Configure parameters for a Java Script Attribute Customization
- Configure custom pre- and post-conditions that have no aspect editor
- Add Formal Project Planning capabilities to agile projects
There are other border cases where access to the XML source and its modification is necessary. For example if you want to undo a change or see and compare the version history.
The XML gets also modified if using the UI, so it needs to be able to be written.
You might want to add an enhancement request here requesting that a special warning is shown that this can be unsafe.
The UI does not support changing the type today for good reasons. I don't know the gory details because that is hidden in the persistency layer. If you just did it with string attributes, you might be safe, dependent on how they are stored.