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 (2542328) | 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=;

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

2 answers

permanent link
Alexander Dawson (2542328) | 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"GET", "https://[your_url_goes_here:port]/jazz/resource/itemOid/" + 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 (99215201157) | 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.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.