Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Seeting default value for Workitem custom attribute

Hello,
I'm creating a custom attribute for a workitem as follow. How can I set its value? Thank you for your help.

IAttribute attribute = getWorkItemClient().createAttribute(
projArea, "Identifier", attributeType, IAttribute.FULL_TEXT_KIND_DEFAULT, monitor);
PermissionContext.setDefault(attribute);
workItem.addCustomAttribute(attribute);
workItem.setValue(attribute, attribute.getIdentifier());

0 votes



One answer

Permanent link
I'm creating a custom attribute for a workitem as follow. How can I
set its value? Thank you for your help.

IAttribute attribute =
getWorkItemClient().createAttribute(
projArea, "Identifier", "SMALL_STRING", "Test
Attribute", monitor);
PermissionContext.setDefault(attribute);
workItem.addCustomAttribute(attribute);
workItem.setValue(attribute,
attribute.getIdentifier());

Here's the corrected version of your code:

// Create an attribute of type small string
IAttribute attribute = getWorkItemClient().createAttribute(projArea,
"com.yourcompany.attribute.test", AttributeTypes.SMALL_STRING, "Test
Attribute", monitor);

// Express that this attribute is part of the work item
workItem.addCustomAttribute(attribute);

// Set a value for this attribute
workItem.setValue(attribute, "Some value");

If you are interested in configuring default values for attributes,
please take a look at:
https://jazz.net/wiki/bin/view/Main/AttributeValueProviders

--
Regards,
Patrick
Jazz Work Item Team

0 votes

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,939

Question asked: Mar 25 '10, 11:05 p.m.

Question was seen: 5,034 times

Last updated: Mar 25 '10, 11:05 p.m.

Confirmation Cancel Confirm