It's all about the answers!

Ask a question

Calculated value script using checkboxes values


Tayane Fernandes (251216) | asked Oct 23 '13, 4:22 p.m.
edited Oct 23 '13, 4:23 p.m.
Hello !
I need to get the enumeration values with checkboxes. I need to get all the values ​​that are checked, but the code below does not work, because returns null.
var complexidade = workItem.getValue("criteriosPriorizacao"); 

The xml is as follows :

<enumeration attributeTypeId="criteriosPriorizacao" name="Critérios de Priorização">
   <literal externalValue="6" icon="" id="criteriosPriorizacao.literal.l1" name="CheckBox 1"/>
   <literal externalValue="5" icon="processattachment:/enumeration/critical.gif" id="criteriosPriorizacao.literal.l3" name="CheckBox 2"/>
   <literal externalValue="4" icon="" id="criteriosPriorizacao.literal.l4" name="CheckBox 3"/>
   <literal externalValue="3" icon="" id="criteriosPriorizacao.literal.l5" name="CheckBox 4"/>
   <literal externalValue="2" icon="" id="criteriosPriorizacao.literal.l6" name="CheckBox 5"/>
   <literal externalValue="1" icon="" id="criteriosPriorizacao.literal.l7" name="CheckBox 6"/>
   <literal default="true" externalValue="0" icon="" id="criteriosPriorizacao.literal.l2" name="Nenhum"/>
</enumeration>


How do I get the checkboxes that are checked?
Thanks!

Accepted answer


permanent link
Millard Ellingsworth (2.5k12431) | answered Oct 25 '13, 9:26 p.m.
FORUM ADMINISTRATOR / JAZZ DEVELOPER
This article: https://jazz.net/wiki/bin/view/Main/AttributeCustomization#API_for_Javascript indicates that there is limited support for working with enumerations via the JavaScript API. Further down in that article there is a section on working with enumerations: https://jazz.net/wiki/bin/view/Main/AttributeCustomization#WorkingWithEnums

I'm not certain, but the name on that second one may be problematic: "name="&lt;span style=" line-height:="" 1.5;"="">CheckBox 2"/>"

Tayane Fernandes selected this answer as the correct answer

Comments
Tayane Fernandes commented Oct 28 '13, 6:52 a.m.

Thank you!

The xml is correct in my code, must have been some mistake when I pasted it here.


Millard Ellingsworth commented Nov 18 '13, 8:39 p.m.
FORUM ADMINISTRATOR / JAZZ DEVELOPER

I just finished up an article that may help: https://jazz.net/library/article/1360 

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.