TFS Work Item configuration - concatenate multiple fields to 1 string field

974 views Asked by At

I've noticed, as we've started customizing TFS work item types, the workarounds that we have to do to have TFS support some basic tasks. One thing that we are trying to do is have a field that consists of concatenating 3 other fields. For example:

New_Field = Field_1 + ", " + Field_2 + ", " + Field_3.

I'm thinking that the only rule that can be used to copy a field is the COPY rule; however, it limits it to copy the value from just 1 field. Does anyone have a possible workaround to support this need?

1

There are 1 answers

1
jessehouwing On BEST ANSWER

This is not possible with standard Process Template Customizations in the way that the concatenated values are stored in a different field.

There is a workaround available, but it requires a serverside plugin that triggers after a workitem is changed. an example implementation of such a plugin would be the TFS Aggregator, using that it's relatively simple to create a rule that concatenates strings, but it has a few drawbacks as well, the primary one, that such changes are only visible once you reload the work item after saving your changes. This behavior may also cause your users to receive errors telling them the workitem has been changed by someone else, asking them to reload and reapply their changes.

Remember that you can also create text labels on a work item form, on which fields can be concatenated. The same is true for generating hyperlinks. These will sort of do a string.Format on existing values to generate a text label or tooltip on your form.

<Control Type="FieldControl" FieldName="System.State" Label="&amp;State:" LabelPosition="Left">
  <Link 
       OpenInNewWindow="true" 
       UrlRoot="http://"           
       UrlPath="myserver.com:8080/tfs/myproject/{0}/_workItems#_a=edit&id=">       
     <Param Index="0" Value="System.State" Type ="Original"/>
  </Link>
</Control>