28 martie 2012 20:21
I am using 2 Req WITs, one of type feature, the 2nd of type scenario which is a child of the 1st one. I would like to add a field to the parent, lets say "MyField", not updatable manually but updated from either an exisiting field or a new integer field I add to 2nd one. So if I have 2 children with a value in this new field of 5, the 2nd with 10, then in the parent item I would like to have 15 in the "MyField".
Is it feasible? if yes, any pointer to any doc or reference
Thanks in advance.
28 martie 2012 21:02
You can see the following thread here:
You can also see this video on Process Customization:We are volunteers, if the reply help you mark it as your answer. thanks!!
29 martie 2012 06:49Moderator
Thanks for your post.
As far as I know, there’s no such a default work item Rule support to copy value from other work items. To get field value from another work item, you should create the custom work item control to achieve that. Please refer to: http://witcustomcontrols.codeplex.com/releases/view/7240.
John Qiao [MSFT]
MSDN Community Support | Feedback to us
1 aprilie 2012 05:50
this is a very common scenario that most people working with the process template are faced with and there are various approaches to solve this:
1. You can create a custom control that will get the links to the child objects, read the values of the childs and write the result into the parent. However, this will not work for Web Access or when editing the WorkItems through Excel or any other client... Another limitation would be that only when you open the parent item the values would be updated, but not when you change the values within the childs (unless you create a custom control there too, which will update the parent, etc...)
2. The most common way to solve this problem is to implement a server-side plug-in. On codeplex, there is an implementation of a plug-in called "TFS Aggregator" which can do exactly what you ask for. Have a look:
3. An alternative is to do this as a service which registers to the WorkItemChanged event. See this example which describes a solution for your scenario (summing up values from child WorkItems):
Advantage of this solution is that it does not run within the application pool of the TFS and hence, does not pose a risk to the connectivity of your Team Foundation Server the way a server-side plug-in can do.
=> Common to all the described approaches is that when you miss one change event (e.g. the plugin crashed and TFS kicked it out of the pool), your data will be inconsistent until you trigger an update for that workitem again. To overcome this limitation, you can for example create a scheduled task that runs a consistency check every day and updates WorkItems if there values are not in sync anymore because of a missed event. This can easily be done through the WorkItem-API of TFS
Hope this info helps...