It's all about the answers!

Ask a question

Can I access a attribute value of a workitem from another workitem?

Ankit Jaiswal (611) | asked Jun 29 '14, 2:55 p.m.

I have a scenrio where we have created a custom workitem which captures details of a users and his skill .As part of the page the reviewer assigns him a Skill Score .

Issue : We will be capturing the data for various users in a department using the workitem . Now we need to find a combined Skill score of a department . For the same we need to access the skill score of all workitems and calculate the final value .

How can I access skill Score from all workitems ?(using scipts ?)

Please help suggest?

sam detweiler commented Jun 29 '14, 3:58 p.m.

best thing to do is run a query to find all the needed workitems,
then process them one by one to get the calculated value.

see my sample pgm on how to process from a query and access the attributes of the workitems.
see the answer here

note that the forum software messes with text case of thing near < and > so you will have a little fixup once u cut/paste.

then define a workitem query to get your workitems

the utility parms are
server_url userid password project_name and name_of_query_to execute

Ankit Jaiswal commented Jun 29 '14, 6:22 p.m.

 Thanks Sam . I am only using RTC and not writing any Java App for this .. what i have done previously is created a atttribute and attach a script based calculation to it for dynamic attribute values in same Workitem . can i use IWorkItemClient , IQueryClient  and other such in Script based using DOJO code ??

sam detweiler commented Jun 29 '14, 7:44 p.m.

Sorry. No idea if the JavaScript runtime env provides enough services to do that. Not likely in my experience . 

Donald Nong commented Jul 04 '14, 12:35 a.m.

The current client side scripting appears to be for attribute customization only, which is confined to the current work item. Even you can load other work items, if you are loading them one by one, it will be very slow. Unless you can run queries in client side scripts, which is a big ask.

One answer

permanent link
Ralph Schoon (57.1k23642) | answered Jul 04 '14, 3:02 a.m.
JavaScript, as far as I am aware, only provides access to the attribute values of the current work item. Specifically what can be accessed is described here:

You can try to write a Java Based attribute customization. The Java API provides more access to data of that work item. I am not sure how far that carries with respect to e.g. following links to other work items.

You can find what I explored here:

Your answer

Register or to post your answer.