It's all about the answers!

Ask a question

How to get values of enumeration list on calculated value javascript?

Cesar Sasaki (511289129) | asked Nov 18 '15, 11:53 a.m.
I'm using a calculated javascript that uses an array inside that contains some days.
The array is filled (hard coded) inside the script, but I would like to use a enumeration list to fill  that array with the values.

Can it be done?


One answer

permanent link
Donald Nong (14.5k614) | answered Nov 19 '15, 3:27 a.m.
Why the change? I assume that you still have to hard code the values somewhere else, such as the process configuration source, right? If you are using the Eclipse client usually, I just don't see the difference if ever you want to change the values, either in the JavaScript source, or the attribute list (you can do the same in the process configuration source).

Anyway, you can check out the below example - it shows a way to use the "configuration" parameter. As mentioned above, you still have to hard code the values.

Cesar Sasaki commented Nov 19 '15, 9:56 a.m.

 Hi Donald

I do not want to hard code the values anymore. Right now I fill my array with something with values inside the script. But if I want to add more values I need to change my script.
What I'm trying to do is get the values from an enumeration an take that to fil the array. So other people (with no knowledge of scripts) can add more values in the enumeration.

Donald Nong commented Nov 19 '15, 11:51 p.m.

That's what I suspect you wanted to do. Note that enumerations are stored in the process configuration, while the attribute customization scripts are not designed to read the process configuration at all. In this case, the script configuration in the aforementioned sample is the only other place you can put the value list. If you want someone else with no knowledge of scripting to change the value list, the process configuration source may not be a better place than the script itself for this purpose.

Your answer

Register or 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.