It's all about the answers!

Ask a question

Field dependent values for the multi-select field in RTC 4.0


Rama SCM (4111018) | asked Dec 18 '12, 2:19 p.m.
Hi,

Since it is not possible to set field dependent values for the multi-select field in RTC 4.0, I am trying to write a script based value set. This values set will provide list of values based on the FIELD_AGAINST field. But so far I am unable to achieve this using the java script that I wrote. I would appreciate if anyone can share the basic java script structure(code), that can read and compare the value of FILED_AGAINST field.

Thanks for your help in advance!
Rama

2 answers



permanent link
Brian Fleming (1.6k11928) | answered Dec 18 '12, 6:56 p.m.
Take a look at this post to see if it helps:

https://jazz.net/forum/questions/92153/how-can-a-script-based-calculated-value-read-the-filed-against-aka-categories-field

Comments
Rama SCM commented Dec 20 '12, 12:00 p.m.

Thanks Brian,

I did not try xmlhttp, but was hoping simple API call will get me the value that I can compare with a string. But so far no luck.

value = workItem.getValue(WorkItemAttributes.FILED_AGAINST)

Thanks!
Rama


permanent link
Rama SCM (4111018) | answered Mar 11 '13, 12:50 p.m.
I will go ahead and answer my own question. After little bit of research, I found out that, workItem.getLabel will get the value of the field. To read the value for FILED_AGAINST field, following statement can be used in Java Script. Once you have the FILED_AGAINST value, you can return different value set for the other field based on the the value read.

           var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
           var category = workItem.getLabel(WorkItemAttributes.FILED_AGAINST);
if (category == "something"){
    result = Something
}else{
   result = Something else
}
           return result;

However,  looks like this approach will only work in Eclipse UI. I am unable to get it working in Web UI. As whenever I change the value of FILED_AGAINST field, it does not change the value of the other filed I am trying to recalculate. Looks like the script based value set does not get triggered on value change in Web UI. It is only triggered, the first time work item is loaded in the browser.

Thanks!
Rama

Thanks!
Rama

Your answer


Register or to post your answer.