1
votes

We are trying to import work items from TFS 2010 to 2012. we defined 2 custom fields called "Legacy Created Date" and "Legacy Changed Date" in our fields for all the work item types. The reason why we had to create these 2 fields for created date and changed date is because after the migration, the created date and changed date are changed to the migration time and the old created/changed dates are lost. We also included these 2 fields in the migration xml like this:

The above 2 statements are included for all work item types. No matter what we tried, these 2 fields are coming in empty post-migration.

We confirmed that the 2 custom fileds are available in the work item type templates [by using TFS power tools and opening the WIT from server]

Any help pls? Thx much!

***UPDATE - ENTIRE MAPPING XML****

<SettingXml>
<WITSessionCustomSetting>
  <Settings />
  <WorkItemTypes>
    <WorkItemType LeftWorkItemTypeName="User Story" RightWorkItemTypeName="Product Backlog Item" fieldMap="UserStoryToProductBacklogItemFieldMap" />
  </WorkItemTypes>
  <FieldMaps>
    <FieldMap name="UserStoryToProductBacklogItemFieldMap">
      <MappedFields>
        <MappedField MapFromSide="Left" LeftName="System.CreatedDate" RightName="Contoso.Field.LegacyCreatedDate" />
        <MappedField MapFromSide="Left" LeftName="System.ChangedDate" RightName="Contoso.Field.LegacyChangedDate" />
        <MappedField MapFromSide="Left" LeftName="System.AreaPath" RightName="System.AreaPath" />
        <MappedField MapFromSide="Left" LeftName="System.AssignedTo" RightName="System.AssignedTo" />
        <MappedField MapFromSide="Left" LeftName="System.AttachedFileCount" RightName="System.AttachedFileCount" />
        <MappedField MapFromSide="Left" LeftName="System.AuthorizedAs" RightName="System.AuthorizedAs" />
        <MappedField MapFromSide="Left" LeftName="System.ChangedBy" RightName="System.ChangedBy" />
        <MappedField MapFromSide="Left" LeftName="Microsoft.VSTS.Common.ClosedDate" RightName="Microsoft.VSTS.Common.ClosedDate" />
        <MappedField MapFromSide="Left" LeftName="Contoso.Field.Contact" RightName="Contoso.Field.Contact" />
        <MappedField MapFromSide="Left" LeftName="System.CreatedBy" RightName="System.CreatedBy" />
        <MappedField MapFromSide="Left" LeftName="Contoso.Field.CustomerName" RightName="Contoso.Field.CustomerName" />
        <MappedField MapFromSide="Left" LeftName="System.Description" RightName="System.Description" />
        <MappedField MapFromSide="Left" LeftName="Contoso.Field.DocSourceUpdateRequired" RightName="Contoso.Field.DocSourceUpdateRequired" />
        <MappedField MapFromSide="Left" LeftName="System.ExternalLinkCount" RightName="System.ExternalLinkCount" />
        <MappedField MapFromSide="Left" LeftName="System.History" RightName="System.History" />
        <MappedField MapFromSide="Left" LeftName="System.HyperLinkCount" RightName="System.HyperLinkCount" />
        <MappedField MapFromSide="Left" LeftName="Microsoft.VSTS.Build.IntegrationBuild" RightName="Microsoft.VSTS.Build.IntegrationBuild" />
        <MappedField MapFromSide="Left" LeftName="Contoso.Field.InternalProduct" RightName="Contoso.Field.InternalProduct" />
        <MappedField MapFromSide="Left" LeftName="System.IterationId" RightName="System.IterationId" />
        <MappedField MapFromSide="Left" LeftName="System.IterationPath" RightName="System.IterationPath" />
        <MappedField MapFromSide="Left" LeftName="System.NodeName" RightName="System.NodeName" />
        <MappedField MapFromSide="Left" LeftName="System.Reason" RightName="System.Reason" />
        <MappedField MapFromSide="Left" LeftName="Contoso.Field.Regulatory" RightName="Contoso.Field.Regulatory" />
        <MappedField MapFromSide="Left" LeftName="System.RelatedLinkCount" RightName="System.RelatedLinkCount" />
        <MappedField MapFromSide="Left" LeftName="Contoso.Field.ReleaseNoteRequired" RightName="Contoso.Field.ReleaseNoteRequired" />
        <MappedField MapFromSide="Left" LeftName="Contoso.Field.ResolutionDetails" RightName="Contoso.Field.ResolutionDetails" />
        <MappedField MapFromSide="Left" LeftName="System.Rev" RightName="System.Rev" />
        <MappedField MapFromSide="Left" LeftName="System.RevisedDate" RightName="System.RevisedDate" />
        <MappedField MapFromSide="Left" LeftName="Contoso.Field.SFDCCaseID" RightName="Contoso.Field.SFDCCaseID" />
        <MappedField MapFromSide="Left" LeftName="Contoso.Field.SFDCCaseNumber" RightName="Contoso.Field.SFDCCaseNumber" />
        <MappedField MapFromSide="Left" LeftName="Contoso.Field.SFDCOrganizationID" RightName="Contoso.Field.SFDCOrganizationID" />
        <MappedField MapFromSide="Left" LeftName="Contoso.Field.SFDCSyncResult" RightName="Contoso.Field.SFDCSyncResult" />
        <MappedField MapFromSide="Left" LeftName="System.State" RightName="System.State" valueMap="userstory_ValueMap" />
        <MappedField MapFromSide="Left" LeftName="System.TeamProject" RightName="System.TeamProject" />
        <MappedField MapFromSide="Left" LeftName="System.Title" RightName="System.Title" />
        <MappedField MapFromSide="Left" LeftName="System.WorkItemType" RightName="System.WorkItemType" />
        <MappedField MapFromSide="Left" LeftName="Microsoft.VSTS.Common.Priority" RightName="Microsoft.VSTS.Common.BacklogPriority" />
        <MappedField MapFromSide="Left" LeftName="Contoso.Field.TestNote" RightName="Microsoft.VSTS.Common.AcceptanceCriteria" />
        <MappedField MapFromSide="Left" LeftName="Microsoft.VSTS.CMMI.Blocked" RightName="Microsoft.VSTS.CMMI.Blocked" />
        <MappedField MapFromSide="Left" LeftName="System.ID" RightName="Contoso.Field.ExternalId" />
      </MappedFields>
    </FieldMap>
  </FieldMaps>
  <ValueMaps>
    <ValueMap name="userstory_ValueMap">
      <Value LeftValue="Unconfirmed" RightValue="New" />
      <Value LeftValue="Need Info" RightValue="New" />
      <Value LeftValue="Info Provided" RightValue="New" />
      <Value LeftValue="Confirmed" RightValue="Approved" />
      <Value LeftValue="Construction" RightValue="Committed" />
      <Value LeftValue="Resolved" RightValue="Committed - Developed" />
      <Value LeftValue="Built" RightValue="Committed - Developed" />
      <Value LeftValue="In Test" RightValue="Committed - Developed" />
      <Value LeftValue="Verified" RightValue="Committed - Tested" />
      <Value LeftValue="Closed" RightValue="Done" />
    </ValueMap>
  </ValueMaps>
</WITSessionCustomSetting>

*****UPDATE - Partial success [not thru integration platform] I gave up on integration platform trying to sync created date and changed date on revisions. I am now focussing my efforts on directly querying the TFS_defaultcollection DB and getting the dates. Here is the sql.. select * from WorkItemswere where id = order by rev This will give all the revisions for a given ID. We can write a post migration script to loop thru all work items and update the "created date" [The CreatedDate column in WorkItemsWere will give that] and the revised date and changed date columns will have all the dates u need. However, the challenge is updating the "changed dates" [I am updating the Created date via the TFS API. Starightforward. Just run console app as a "service account" TFS user, "open" the work item, modify the created date and "save" it]. I am querying the source systems WorkItemsWere table, getting the Changed and Revision dates by each "Rev" and updating the target systems "WorkItemsWere" [It's important that the source and target systems are locked so no updats are happening during this script]. After the script ran, I picked a workitem on a taregt system and checked it's history. All the history disappeared!!.. So, bad idea directly updating the changed/revision dates in DB. However, I found a workaround. If you just update the "revision date" and NOT the "changed date", it does show the history. [without the 'Rev #"]. This is an ok workaround for us. Will keep everyone posted.

2
Obvisouly the xml definitions are removed from my post. But, the left and right values are defined correctly to map from system.createddate to LegacyCreatedDate in the xml mapping file.Teeboy
Can you post the XML definition for the fields, as well as the exact XML of the mappings? Are there any errors that occur during the migration?James Tupper
Thx James. Here are my mapped fields. {<MappedField MapFromSide="Left" LeftName="System.CreatedDate" RightName="Contoso.Field.LegacyCreatedDate" /> <MappedField MapFromSide="Left" LeftName="System.ChangedDate" RightName="Contoso.Field.LegacyChangedDate" />} .. And here are my field definitions in WIT. <FIELD name="Legacy Created Date" refname="Contoso.Field.LegacyCreatedDate" type="DateTime" reportable="dimension" /> <FIELD name="Legacy Changed Date" refname="Contoso.Field.LegacyChangedDate" type="DateTime" reportable="dimension" />}Teeboy
No, there are no errors during the migration. I am only migrating a few records for testing purposes.Teeboy
I see no issues with the field definitions or mapped fields. Can you post the full configuration of the TFSIP Configuration File?James Tupper

2 Answers

1
votes

I was able to solve it by directly updating the tables WorkItemsWere and WorkItemsLongtext in TFS. Specifically, the columns Revised date and changed date in WorkItemsWere and Changed Date in workitemslongtext. I just wrote a script that loops thru all work items and gets all the revisions from the old TFS instance. Get the revised date/changed dates from WorkItemsWeere table and update the dates in the target system. works like a charm.

0
votes

After some digging, it looks like the TFS Integration Platform treats these two fields in a special, and by special I mean that they ignore them when the user tries mapping them in the configuration file. Here is a link to a forum post that outlines this specifically: http://social.msdn.microsoft.com/Forums/en-US/tfsintegration/thread/e310e35b-e1b7-4f60-a2bf-15ad5016e736/. Again, this doesn't mean these values disappear, they should be held in the history comments of the new work items in the target TFS environment (as noted in my comment).