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

Getting RTC Enumeration External Value through js Calculated Value script

 Hello, 

I'm implementing a custom calculated script to calculate value of 2 enums. 
I understand how to get the labels of the enum, but I would like to get the external value.
I don't see anywhere in the API which function to get not the label but the external value of the enum literals. 

Does someone know which magic to use to get this value ? 

Thank you for your help

0 votes


Accepted answer

Permanent link

  What is an external value for an enumeration? For a specific enumeration value in an attribute, you can access


1. The display value using getLabel();
2. The id of the enumeration using getValue();

https://jazz.net/wiki/bin/view/Main/AttributeCustomization does not specify any additional values.

Sany Maamari selected this answer as the correct answer

0 votes

Comments

 Hello Ralph, 

Thank you for your answer 
The external value is what I squared in red, Are they accessible

 Ok, Thanks Ralph, I will work with the labels

 The getValue() returns the ID and the ID

  • Is language independent
  • does never change
So usually you would work with the id's.


One other answer

Permanent link

I have a script that uses REST to get enumeration values of a work item other than the current work item (the one in view as the script is running). In RTC 5.x, this returned resource URLs to enumeration literals which were structured like this:

{base url}/ccm/oslc/enumerations/{project area OID}/{[enumerationList$]enumeration ID}/{external value if available, otherwise ID}

So I used to just parse the last segment of the resource URL so that I could get external values without turning around another REST call.

In 6.x, there was an error in my script that I found out was caused by the fact that RTC 6.x always returns resource URLs to enumeration literals structured like this:

{base url}/ccm/oslc/enumerations/{project area OID}/{[enumerationList$]enumeration ID}/{enumeration ID, even if an external value is available}

I got to this question right away upon searching for information about this change. If I get the time, I'll look into the release notes for RTC 6. I'll just write a method to turn around and call the resource URL for the complete literal's object in JSON and parse that for the actual label or external value.

Thought I'd share that in case it applies to Sany's question, or to others who search for similar needs.

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

Question asked: Feb 14 '17, 5:52 a.m.

Question was seen: 3,347 times

Last updated: Mar 13 '17, 4:34 p.m.

Confirmation Cancel Confirm