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

How to get the custom attributes programatically?

Hi,
I want to check values of custom attributes for certain conditions. How to get the custom attribute values???

Thanks,
Dnyanesh

1

0 votes


Accepted answer

Permanent link
the problem we have is that you haven't said what kind of program

client
server
java
javascript
OLSC
??

here are links to some code in Java for Client and Server (Advisor or Participant)
that accesses all the attributes..

client - see the 'accepted answer' here https://jazz.net/forum/questions/94776/assertionfailedexception-problem-with-getting-the-values-of-attributes
server - see the third post here https://jazz.net/forum/questions/76276/how-to-get-the-value-selected-by-user-from-a-drop-down-list
Dnyanesh Markad selected this answer as the correct answer

0 votes

Comments

Hi all ,
I am developing server side code for advisor . Now I have defined custom attribute custA which is of type enumeration say Enum1. Now I have added that attribute in workitem. While saving the workitem I have selected multiple number of items say 3 from custom attribute custA. Now I just want the number of selected items from the list means how to get that 3 programatically.? means my code should return 3.

Thanks,
Dnyanesh

I haven't really done this, as I see it there are two options using Java in a server extension.

1. If the attribute is of type String, the multi selection is, unfortunately, just done by concatenating the enumeration literals in the string, separated by ; or , or something like that. If you get and print the attribute value, you should be able to understand the format. In this case the number is just either the number of strings you get back with value.split(";"). You can also count the separators.
2. If the attribute is a list type, you should get it back as some list and be able to use the size of the list.

If you haven't found examples already, here a small introduction on how to get at work item attributes in the Java API. http://rsjazz.wordpress.com/2013/01/02/working-with-work-item-attributes/


One other answer

Permanent link
you could use getValue with attribute id specified within double quotes

sample code:
var custAttr = workItem.getValue("custAttrID");
hope it helps

1 vote

Comments

This is of course the syntax if using a script based customization. Since the question fails to give enough context, it is unclear if that is the question. This blog answers this question for the plain java client library and other extensions as well.

Hi,

In deatail, suppose I have one custom attribute as custA. Its type is medium string. In editor presentations I have assigned the attribute values as list. So now I want to get the number of selected attributes in the list programatically. 

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,927

Question asked: Dec 28 '12, 8:25 a.m.

Question was seen: 5,459 times

Last updated: Jan 02 '13, 9:01 a.m.

Confirmation Cancel Confirm