image

Recently the question came up whether it is possible to map a source field to more than one target field, in other words duplicating the source field into more than one target field.

Using a FieldMap we can map a source field to only one target field.

The following configuration snippet is not legal, whereby only the first mapping is honoured at this stage and in future builds the configuration will not be allowed. The current symptom is that the ResolvedReason field on the target is always empty.

  1. <MappedField LeftName="System.Reason" RightName="System.Reason" MapFromSide="Left" valueMap="ReasonValueMap" />
  2. <MappedField LeftName="System.Reason" RightName="Microsoft.VSTS.Common.ResolvedReason" MapFromSide="Left" valueMap="ResolvedReasonValueMap" />

However, we can achieve the multiple mapping by using the aggregated field feature, by replacing the second and other additional MappedField with the following aggregated field mapping:

  1. <AggregatedFields>
  2.     <FieldsAggregationGroup MapFromSide="Left" TargetFieldName="Microsoft.VSTS.Common.ResolvedReason" Format="{0}'">
  3.       <SourceField Index="0" SourceFieldName="System.Reason" valueMap="ResolvedReasonValueMap"/>
  4.     </FieldsAggregationGroup>
  5. </AggregatedFields>

NOTE: The above are snippets from the configuration file and must be configured as part of a complete configuration file.