Getting RTC Enumeration External Value through js Calculated Value script
![]()
Sany Maamari (132●4●38●51)
| asked Feb 14 '17, 5:52 a.m.
edited Feb 14 '17, 10:36 a.m. by Ralph Schoon (63.3k●3●36●46) 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
|
Accepted answer
![]()
Ralph Schoon (63.3k●3●36●46)
| answered Feb 14 '17, 6:08 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER 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
Comments Hello Ralph,
Thank you for your answer
The external value is what I squared in red, Are they accessible
![]() Not from what https://jazz.net/wiki/bin/view/Main/AttributeCustomization explains. Ok, Thanks Ralph, I will work with the labels ![]() FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
The getValue() returns the ID and the ID
So usually you would work with the id's.
|
One other answer
![]() 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. |
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.