How can I return an enumeration value to a calculated value using javascript?
I have an attribute called Attention Flag which is an enumeration that contains "Reopened" and "Test Failed" as values in the enumeration list. I would like to have that attribute as read only and calculate the value based on other attributes using Javascript. I have tried using
return "Reopened"
or
return "Test Failed"
Both of these lines will properly return the value, but I get a warning red "x" flag on the attribute with the message "The selected value is not applicable." It does not show the corresponding enumeration value with the associated icon. I want it to show the enumeration value with the icon, not an error message. Is there a way to return a value that will be one of the valid values in the enumeration list?
|
One answer
I think you need to use the name of the literal. Check in the configuration source. It should have a name like "myenumeration.literal.l10";
Then you can do some thing like
return "myenumeration.literal.l10";
See this document under section "Working with Enumerations":
Comments https://jazz.net/library/article/1093 tries to explain a lot of these questions in the last lab.
Janet Charbonneau
commented Oct 26 '19, 7:13 p.m.
Ian, I have tried
return "attentionflagenumeration.literal.14";
and it just returns
attentionflagenumeration.literal.14
It doesn't recognize it as one of the enumeration entries.
Ralph, I looked into that last lab, but maybe I missed something. I will research those further. Thanks.
Ralph Schoon
commented Oct 28 '19, 6:34 a.m.
| edited Oct 28 '19, 7:12 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi Janet.
Note, I would suggest to develop attribute customization on test systems and not on the production system.
There are possible strategies to proceed.
Ian Wark
commented Oct 28 '19, 11:39 p.m.
When I do attribute customization, I generally have a bunch of logging in place, as Ralph suggests. For example, you can use something like this:
console.log("My message");
See this URL too for ideas to debug your Javascript:
|
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.