It's all about the answers!

Ask a question

rtc api : add attributes and editor presentation elements

Gidi Gal (961736) | asked Feb 26 '14, 5:18 p.m.
Hello to the forum members,

I defined couple of attributes and some related presentations for a work-item. I'd like to prepare some sort of setup script that will create these items.
I'm digging into RTC SDK API in search for an API that will allow me to add attributes and editor presentation elements, currently with no luck. If you have a link to sample code that does that it would be great if you could add it here.

Many thanks,

Gidi Gal commented Feb 27 '14, 2:18 a.m.

Some more information on this question:
If it was possible to export\import this part of the project area (process configuration) using repotools or a different tool, I could use this option instead of writing my own code. However, reading the mentioned below questions\work items, I understand it is not possible.

One answer

permanent link
Ralph Schoon (59.0k23642) | answered Feb 27 '14, 2:45 a.m.
edited Feb 27 '14, 4:14 a.m.
This code adds the attribute to the project area, if it is not available
if (null == customString && fCreateAttributesIfMissing) {
		customString = workItemClient.createNewAttribute(fProjectArea,
				fCustomStringAttributeID, AttributeTypes.SMALL_STRING,
						IAttribute.FULL_TEXT_KIND_DEFAULT, monitor);
		customString.setDisplayName("Created String ("
				+ fCustomStringAttributeID + ")");
		customString = workItemClient.saveAttribute(customString,

if (!workItem.hasCustomAttribute(customString)) {
		// If not defined in the process template it has to be
		// manually created
Caveat of this approach was that the attribute was not available in the process XML as far as I remember. It was available for usage in the project, but did not show up in the configuration editor. I have not tried this for a very long time.

All the code needed to create new attributes and editor presentations is available in the Eclipse client. Out of curiosity I have looked at the project area editor to find out more. However, it is so abstracted out and really complex, that I gave up trying, because I did not have the business justification to spend days on it.

Ralph Schoon commented Feb 27 '14, 3:57 a.m.

I just checked and the attribute gets created on the work item and can be set and shows up in the custom tab in Eclipse. However, It never shows up in the project configuration XML.

I can create editor presentations for it, but It is only listed in the "Archived Attributes". I am not sure which step I would have to take to get it listed as available attribute.

Ralph Schoon commented Feb 27 '14, 4:03 a.m.

One more finding: After the attribute was created, it does not show up in the listof attributes of the work item type, I created it at.
However, I am able to select the attribute type and add the attribute as "Existing". This means, there is a step missing that associates the attribute to the work item type. I will look into what that could be.

Your answer

Register or to post your answer.