Calculated value script using checkboxes values
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
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="<span style=" line-height:="" 1.5;"="">CheckBox 2"/>"
Comments
Thank you!
The xml is correct in my code, must have been some mistake when I pasted it here.
The problem I'm having with the checkbox is like this question: https://jazz.net/forum/questions/119517/attribute-customization-can-a-calculated-value-use-the-contents-of-checkbox-enumeration-list-without-a-save-using-js?page=1&focusedAnswerId=131779#131779
I just finished up an article that may help: https://jazz.net/library/article/1360