Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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: 

_kYGxVPNzEeG4Q42SASfG2w

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

This is in version 3.0.1.2

0 votes



2 answers

Permanent link

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.

1 vote


Permanent link
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.

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Oct 25 '12, 11:04 a.m.

Question was seen: 3,811 times

Last updated: Oct 31 '12, 2:18 p.m.

Confirmation Cancel Confirm