How can a Script Based Calculated value read the Filed Against aka Categories field
![]() 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:
How can I get the value displayed in the drop down?
This is in version 3.0.1.2 |
2 answers
![]() 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.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. |
![]()
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. |