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
Hello Donald, Can you help me how did you debugged this info Check out these articles.
Thanks Donald |