It's all about the answers!

Ask a question

How can a Script Based Calculated value read the Filed Against aka Categories field


Alexander Dawson (2542228) | asked Oct 25 '12, 11:04 a.m.
edited Oct 25 '12, 11:44 a.m.

I'm developing a Script Based Calculated value that needs to read the Filed Against Field and display it in a different field.

When creating the javascript i'm using the line:

var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;

value = workItem.getValue(WorkItemAttributes.FILED_AGAINST)

to read the value. 

This only returns a key to the category table: 

_kYGxVPNzEeG4Q42SASfG2w

How can I get the value displayed in the drop down?

This is in version 3.0.1.2

2 answers



permanent link
Alexander Dawson (2542228) | answered Oct 31 '12, 2:17 p.m.
edited Oct 31 '12, 2:18 p.m.

I'm going to go ahead and answer my own question.  Additional research provided the answer:

Using xmlhttp javascript calls hold the answer;  categoryValue holds the Filed Against label value:

var xmlhttp=new XMLHtttpRequest();  //declare a lookup  

//define the query
xmlhttp.open("GET", "https://[your_url_goes_here:port]/jazz/resource/itemOid/com.ibm.team.workitem.Category/" + workItem.getValue(WorkItemAttributes.FILED_AGAINST) + "?_mediaType=application/xml", false);

xmlhttp.send(); //send it 

var xmlDoc=xmlhttp.responseXML; //store reponse

var tagList=xmlDoc.getElementsByTagName("dc:title");  //look for the tags containing the category name

var categoryValue=tagList[0].childNodes[0].nodeValue;  //store the category name's element value.  In theory it could be more than one so we only take the first.


permanent link
Michael Walker (99213197157) | answered Oct 26 '12, 12:05 a.m.
You need to map the id of the Filed Against values to the ones listed in the drop down.  Example: '_Br43st23qws' maps to 'Install/Customization'. 

The only way I know to do it is create a calculated script that returns the FILED_AGAINST value, create a custom string field that uses this script and make it dependent on Filed Against. Add it to the work item presentation and when you create a work item, for every Filed Against value you select, it's id should appear in the custom string field so you can map them.

Your answer


Register or to post your answer.