How do I read custom text field based on the custom enumaration type using java script based.
Hi Team,
Working with EnumerationsAn enumeration is a special attribute type that allows an attribute to have one of a fixed predefined set of values called literals. When you define an enumeration you specify a name for each literal. Internally each literal is assigned a literal id. You can also manually configure this id in the process specification. When working with enumerations inside an attribute customization script you should use the literal ids to refer to literals and not their names. To see what the id for a literal is, open the process configuration source XML and look for the enumeration definition. Here is, for example, the configuration of the Severity enumeration:<enumeration attributeTypeId="severity" name="Severity"> <literal icon="processattachment:/enumeration/unassigned2.gif" id="severity.literal.l1" name="Unclassified"/> <literal icon="processattachment:/enumeration/minor.gif" id="severity.literal.l2" name="Minor"/> <literal default="true" icon="processattachment:/enumeration/normal.gif" id="severity.literal.l3" name="Normal"/> <literal icon="processattachment:/enumeration/major.gif" id="severity.literal.l4" name="Major"/> <literal icon="processattachment:/enumeration/critical.gif" id="severity.literal.l5" name="Critical"/> <literal icon="processattachment:/enumeration/blocker.gif" id="severity.literal.l6" name="Blocker"/> </enumeration>Please suggest if there is any other way. |
Accepted answer
Although I don't truly understand your intent of duplicating an enumeration value to a string attribute, you should use the getLabel() function instead of getValue() to read the enumeration. For example, using the Enumeration definition that you quoted, getLabel() returns "Minor", while getValue() returns "severity.literal.l2".
Prasad Makkena selected this answer as the correct answer
Comments
Prasad Makkena
commented Jan 09 '18, 11:02 p.m.
Thanks a lot Donald, using getLable() able to read the enumeration whatever I selected. For example If I select in enumeration as [aa bb cc] I should only read "aa" instead of entire [aa bb cc] I think something wrong with my code, can you please help me here
Prasad Makkena
commented Jan 09 '18, 11:03 p.m.
here is mu code
dojo.provide("com.example.programid");
(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
var ppmoprj;
ppmoprj = workItem.getLabel("com.attribute.ppmoprj");
|
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.
Comments
What is the requirement? You describe a solution sketch that I don't understand. See How should I ask a question in the Forum if I want to receive useful answers?