It's all about the answers!

Ask a question

Java/Dojo script to change the attribute name depending on other attribute.


Deepali Deshmukh (581243) | asked Dec 09 '16, 2:11 a.m.
I have the below scenario for which I need to write java or dojo script. 
On a work item there are two tab A and B. There is a multi select attribute on Tab A. On tab B I have 50 attribute of type medium string. when selected multiple values on tab A, The attribute name/label should change to the names that are selected on tab A. example. if a select values as Red, Green, Organ, Blue (Multi select) on tab A. On tab B text box should be --->  Red [ ] Green[ ] Organ[ ] Blue[ ] . 

I am trying to write the script. But confused it should be applied for calculated values or value set, more over is it feasible to do so. Below is the bit of script which I am unable to complete. Can anyone of you help me to complete or share your script.  

dojo.provide("org.fca.workitems.providers.Get_Colour");
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.fca.workitems.providers.ShowSWComponent", null, {
    getValueSet: function(attributeId, workItem, configuration) {
var multiselect = workItem.getValue("com.ibm.team.workitem.attribute.colour");
var SplitedString = multiselect.split("|");// here i get the individule values from multiselect
for(var i=1; i<SplitedString.length-1;i++)
{
// how to loop into to set the attribute label
as we have workItem.getLabel what do we have for setlabel ?

Thanks in Advance!

Accepted answer


permanent link
Ralph Schoon (55.1k23642) | answered Dec 09 '16, 4:04 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Dec 09 '16, 4:07 a.m.
You say the attribute name should change. This is not supported.

If you refer to the attribute value to change, then this is a completely different matter and calculated values might be a possible solution.

Dependent enumeration is a different thing, basically limiting the possible value choice in one attribute based on the value in another one. You can find information about the API e.g. setValue() in https://jazz.net/wiki/bin/view/Main/AttributeCustomization Lab 5 and https://jazz.net/library/article/1093.

Note, you can only set the value of an attribute. The value then determines the value (label) displayed in the UI.
Deepali Deshmukh selected this answer as the correct answer

One other answer



permanent link
Ralph Schoon (55.1k23642) | answered Dec 09 '16, 2:30 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
 As far as i can tell, there is no API to do anything like this.

Comments
Deepali Deshmukh commented Dec 09 '16, 3:57 a.m.

 I am not sure but using enumeration field dependent on other attribute and calculated value set  it is possible. 

Your answer


Register or to post your answer.