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

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?

0 votes



One answer

Permanent link
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":

1 vote

Comments

https://jazz.net/library/article/1093 tries to explain a lot of these questions in the last lab. 

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.

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.

  1. Try using the debugger, to see what goes on.
  2. Check the logs for an error message see the Process Enactment Workshop to find the log to look into.
  3. Use the AttributeValueAnalyzer from the Process Enactment Workshop to understand the enumeration literal values you get with getValue(), especially for your attribute. These are the values you want to set. You should be able to find them in the project area administration, but somehow something seems to be not right. 
  4. Make the target attribute not read only and check if that changes anything. 

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

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
× 6,117
× 152

Question asked: Oct 24 '19, 1:07 p.m.

Question was seen: 1,989 times

Last updated: Oct 28 '19, 11:39 p.m.

Confirmation Cancel Confirm