Copy attribute from Project Area to Other Project Area programmatically
|
Accepted answer
Ralph Schoon (63.4k●3●36●46)
| answered May 05 '17, 9:39 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited May 08 '17, 4:05 a.m. This is no different from using CSV export and import. You basically have to map
For the attribute, if you have a shared process, the ID's are the same, but the IAttribute is different, so you have to look the attribute IAttribute object up, it is different from the one you get from the source attribute.
The conversion of data depends. It is trivial to pass a string or an int or a boolean value, as that is by value and the value is primitive. Anything more complex needs to be looked up. "Found in", "Planned For", Category,....., Enumerations anything not a trivial object you need to read the original value and then find the target object based on that.
Look at the work item command line modify work item or the import. It does the same and searches anything not trivial by ID in the target. process.
For the copy it is irrelevant, if the project areas inherit the same process. The only simplification is that the ID's for process elements will be the same and you should find the enumeration values.
Other items such as iterations, timelines, team area hierarchy, categories will be different.
vinitha dsouza selected this answer as the correct answer
|
One other answer
Ralph Schoon (63.4k●3●36●46)
| answered May 05 '17, 2:17 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER You r error message above does not show anything of value.
It is absolutely possible to copy data over. However, even if the attributes in the different project areas have the sane ID and value types, they are different attributes and you will have to find the IAttribute in both project areas and you will have to map values to be able to set them. E.g. a timeline or an iteration even if the ID is the same they are different objects in the different project areas and you will have to look them up using the ID and can't just pass the old object.
Comments I have updated now with Code (Above).
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.