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

How to read workitem list using javascript

 I am using RTC 5.0
I have a requirement to create a string by concatenating all the values present in the sub task list (Work item List)

I have used the script as below:
 var selectedValues = workItem.getValue("MyTask");
   var valueNames = '';
   for (var i=0; i < selectedValues.length; i++) {
       valueNames += selectedValues[i].id + ", "
   }

but it is giving me undefined value as output, I think we need to use something else instead of keyword id.
Is there any list of specific attributes to access Name or auto-generated number of workitem present in workitem list.

0 votes


Accepted answer

Permanent link
You need to be careful when dealing with JavaScript objects - you just can't assume that the object has an "id" attribute. Do some debugging and see what the object really is. I will show what it looks like in Chrome, and you need to figure out how to read the "id" and "summary" from the object.

Pankaj Sharma selected this answer as the correct answer

0 votes

Comments

 This worked i used it like selectedValues[i].attributes[1].value.id + ", " and it worked.


Thanks Donald

Hello Donald,

Can you help me how did you debugged this info

Thanks Donald

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
× 12,019
× 152
× 57
× 35

Question asked: Aug 04 '15, 2:56 p.m.

Question was seen: 3,528 times

Last updated: Nov 03 '15, 3:38 p.m.

Confirmation Cancel Confirm