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.
|
Accepted answer
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
Comments This worked i used it like selectedValues[i].attributes[1].value.id + ", " and it worked.
Thanks Donald
Pankaj Sharma
commented Nov 02 '15, 6:51 p.m.
Hello Donald, Can you help me how did you debugged this info
Donald Nong
commented Nov 02 '15, 8:58 p.m.
Check out these articles.
Pankaj Sharma
commented Nov 03 '15, 3:38 p.m.
Thanks Donald |
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.