Fetch selected literal value in enumeration list through script
2 answers
Amit, please get https://jazz.net/library/article/1093 and go through Lab 5. Especially read the section about what JavaScript can do and can't.
You can access the data using getValue() which returns the enumeration literal as string or getLabel() which returns the display text of the literal as text.
You can access the data using getValue() which returns the enumeration literal as string or getLabel() which returns the display text of the literal as text.
Comments
And make sure not to confuse concepts. You probably created an attribute of type enumeration and you created an editor presentation for that attribute that shows the selected value as radio button.
Hi Ralph,
Thanks for your reply.
i want to retrieve value of only selected literal, so how can i get the selected literal value?
The script can only access the values assigned to the attribute - the ones selected. See https://jazz.net/wiki/bin/view/Main/AttributeCustomization or https://jazz.net/library/article/1093 Lab 5.
hello team,
I created two attribute one is attribute type enumeration having name "task status" below are the task status list:
Un-Assigned (Deafult),
Work In Progress(WIP),
On-Hold,
Completed,
Abandoned,
Rework,
Rework Completed
and another attribute type is timestamp having name "actual start date". now the thing is that whenever user select Task status as "Work in progress(WIP)" then actual start date set by current date and time.
for this I create script using value-set but its not working
My script is:
dojo.provide("org.example.workitems.providers.Actualstartdatescript");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("dojo.string");
(function() {
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("org.example.workitems.providers.Actualstartdatescript", null, {
getValueSet: function(attributeId, workItem, configuration) {
var actual_sd=workItem.getValue("actusl");
var TaskStatus=workItem.getValue("task_s");
if(task_s=="Work In Progress(WIP)")
{
return actual_sd.Date.now();
}
else
{
return "";
}
return actual_sd;
}
});
})();
I think this code is wrong please correct me.
and also I went through many of the solution but I am confused about how to get one particular value or selected value from enumeration and then assign that to actual start date by script.
thanks in advance
sayli