It's all about the answers!

Ask a question

Acces Enumeration with Javascript Condition


Marcos Sánchez (19711) | asked Jul 30 '12, 5:42 a.m.
edited Mar 21 '13, 11:27 a.m. by Ralph Schoon (63.1k33646)
Hi everyone,

I want to have  acces a workitem enumeration with Javascript.

My enumeration config:

    <attributeDefinition id="tipologíaProyecto" name="Tipología Proyecto" type="silk.tipologiaProyecto"/>

   <enumeration attributeTypeId="silk.tipologiaProyecto" name="Tipos Proyecto">

                        <literal icon="processattachment:/enumeration/minor.gif" id="silk.tipologiaProyecto.literal.l2" name="Singular"/>
                        <literal default="true" icon="processattachment:/enumeration/normal.gif" id="silk.tipologiaProyecto.literal.l3" name="NO RTB"/>
                        <literal icon="" id="silk.tipologiaProyecto.literal.l4" name="RTB"/>
                        <literal icon="" id="silk.tipologiaProyecto.literal.l5" name="Servicio Adicional"/>
                    </enumeration>

I doing (javascript)

dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;

matches: function(workItem, configuration) {
                var tipo= workItem.getValue(WorkItemAttributes.tipologíaProyecto);
alert("Enumeration choice Tipo="+tipo);
...

I see:

alert (Null)

What am I doing wrong?

Thanks for advance.

Accepted answer


permanent link
Ralph Schoon (63.1k33646) | answered Jul 30 '12, 6:29 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi,

you want to use var tipo= workItem.getValue("tipologíaProyecto"). You pass the ID as string. The WorkItemAttributes only has values for the attributes in the list of the wiKi topic.
Marcos Sánchez selected this answer as the correct answer

One other answer



permanent link
Marcos Sánchez (19711) | answered Jul 30 '12, 6:48 a.m.
Ok ,thanks Ralph!!

I try with another enumeration and its OK!, but the problem is my "i" accent (tipología) doesn't work, i think..

Comments
Ralph Schoon commented Jul 30 '12, 7:02 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I would suggest to avoid any special caracters in these ID's. I am not sure if this is intented to be supported. If you think it is necessary, I would suggest you write a work item.

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.