vsts-sync-migratorazure-devops-migration-tools

Need to moved the closed work items between two AzureDevops Organization


By using VstsSyncMigrator Tool, I have successfully migrated the work items from one Azure Devops organization to another ( Agile based process). In my case all the open work items are migrated rather than the closed one. But I need to migrate the closed one also. How could I do with the same (migrate the closed work items)?

Below is my Json file. How can I do the migrate of closed work items?

{
    "Version": "8.9",
    "TelemetryEnableTrace": false,
    "workaroundForQuerySOAPBugEnabled": false,
    "Source": {
      "Collection": "",
      "Project": "",
      "ReflectedWorkItemIDFieldName": "", 
      "AllowCrossProjectLinking": false,
      //"AllowCrossProjectLinking": true,
      "PersonalAccessToken": ""
    },
    "Target": {
      "Collection": "",
      "Project": "",
      "ReflectedWorkItemIDFieldName": "",
      "AllowCrossProjectLinking": false,
      //"AllowCrossProjectLinking": true,
      "PersonalAccessToken": ""
    },
    "FieldMaps": [
      {
        //Not Required
        "ObjectType": "VstsSyncMigrator.Engine.Configuration.FieldMap.MultiValueConditionalMapConfig",
        "WorkItemTypeName": "*",
        "sourceFieldsAndValues": {
          "Field1": "Value1",
          "Field2": "Value2"
        },
        "targetFieldsAndValues": {
          "Field1": "Value1",
          "Field2": "Value2"
        }
      },
      {
        //Not Required
        "ObjectType": "VstsSyncMigrator.Engine.Configuration.FieldMap.FieldBlankMapConfig",
        "WorkItemTypeName": "*",
        "targetField": "TfsMigrationTool.ReflectedWorkItemId"
         //"targetField" :"AsSyssProjectDataLink"

      },
      {
        //Not Required, here we can take the default value as it is.
        "ObjectType": "VstsSyncMigrator.Engine.Configuration.FieldMap.FieldValueMapConfig",
        "WorkItemTypeName": "*",
        "sourceField": "System.State",
        "targetField": "System.State"     
            //"defaultValue": "New",
                    //"valueMapping": {
                    //"Approved" : "Approved",
                    //"New" : "New", 
                    //"Commited" : "Commited",
                    //"In Progress" :"In Progress",
                    //"To Do" : "To Do",
                    //"Removed" : "Removed",
                    //"Open" : "Open",
                    //"Closed" : "Closed"
                    //"Design" : "Design",
                    //"Ready" : "Ready",
                    //"Active" : "Active",
                    //"Inactive" : "Inactive",
                    //"Done" : "Done",
                    //"Fixed" : "Fixed"   

      //    }
          },
       //{
        // In Bug workitem the filed value are mappping for Detailed to SystemInfo
        //"ObjectType": "VstsSyncMigrator.Engine.Configuration.FieldMap.FieldtoFieldMapConfig",
        //"WorkItemTypeName": "Bug",      
        //"sourceField": "Sirius.ReprostepsDetailed",
        //"targetField": "Microsoft.VSTS.TCM.SystemInfo"
        //},
      {
        // In Bug workitem the filed value are mappping for Detailed to SystemInfo
        "ObjectType": "VstsSyncMigrator.Engine.Configuration.FieldMap.FieldtoFieldMapConfig",
        "WorkItemTypeName": "*",
        "sourceField": "Microsoft.VSTS.Common.BacklogPriority",
        "targetField": "Microsoft.VSTS.Common.StackRank"

      },
      {
        //Not Required
        "ObjectType": "VstsSyncMigrator.Engine.Configuration.FieldMap.FieldtoFieldMultiMapConfig",
        "WorkItemTypeName": "*",
        "SourceToTargetMappings": {
          "SourceField1": "TargetField1",
          "SourceField2": "TargetField2"
        }
      },
      {
        //Not Required
        "ObjectType": "VstsSyncMigrator.Engine.Configuration.FieldMap.FieldtoTagMapConfig",
        "WorkItemTypeName": "*",
        "sourceField": "System.State",
        "formatExpression": "ScrumState:{0}"
      },
      {
        //Not Required
        "ObjectType": "VstsSyncMigrator.Engine.Configuration.FieldMap.FieldMergeMapConfig",
        "WorkItemTypeName": "*",
        "sourceField1": "System.Description",
        "sourceField2": "Microsoft.VSTS.Common.AcceptanceCriteria",
        "targetField": "System.Description",
        "formatExpression": "{0} <br/><br/><h3>Acceptance Criteria</h3>{1}",
        "doneMatch": "##DONE##"
      },
      {
        //Not Required
        "ObjectType": "VstsSyncMigrator.Engine.Configuration.FieldMap.RegexFieldMapConfig",
        "WorkItemTypeName": "*",
        "sourceField": "COMPANY.PRODUCT.Release",
        "targetField": "COMPANY.DEVISION.MinorReleaseVersion",
        "pattern": "PRODUCT \\d{4}.(\\d{1})",
        "replacement": "$1"
      },
      {
        //Not Required
        "ObjectType": "VstsSyncMigrator.Engine.Configuration.FieldMap.FieldValuetoTagMapConfig",
        "WorkItemTypeName": "*",
        "sourceField": "Microsoft.VSTS.CMMI.Blocked",
        "pattern": "Yes",
        "formatExpression": "{0}"
      },
      {
        //Not Required
        "ObjectType": "VstsSyncMigrator.Engine.Configuration.FieldMap.TreeToTagMapConfig",
        "WorkItemTypeName": "*",
        "toSkip": 3,
        "timeTravel": 1
      }
    ],
    "WorkItemTypeDefinition": {
      //"sourceWorkItemTypeName": "targetWorkItemTypeName"
      //Since on source Requrement workitem is Prodcut Backlog on Target
      //"Requirement" : "Product Backlog Item"
      "Bug" : "Bug",
      "Epic" : "Epic",
      "Feature" : "Feature",
      "Issue" : "Issue",
      "Task" : "Task",
      "Test Case" :  "Test Case",    
      "Test Plan" :"Test Plan",
      "Test Suite" : "Test Suite",
      "User Story" : "User Story"   

    },
    "GitRepoMapping": null,
    "Processors": [
      {
        // As it is since Area and Iteraion value are coping here
        "ObjectType": "VstsSyncMigrator.Engine.Configuration.Processing.NodeStructuresMigrationConfig",
        "PrefixProjectToNodes": false,
        "Enabled": false,
        "BasePaths": [
          //"Product\\Area\\Path1",
          //"Product\\Area\\Path2"
        ]
      },
      {
        //Workitmes are coping with Histoy, Attachment, Link
        "ObjectType": "VstsSyncMigrator.Engine.Configuration.Processing.WorkItemMigrationConfig",
        "ReplayRevisions": true,
        "PrefixProjectToNodes": false,
        "UpdateCreatedDate": true,
        "UpdateCreatedBy": true,
        "UpdateSourceReflectedId": false,
        "BuildFieldTable": false,
        "AppendMigrationToolSignatureFooter": false,
        //"QueryBit": "AND  [Microsoft.VSTS.Common.ClosedDate] = '' AND [System.WorkItemType] IN ('Epic', 'Feature', 'Bug', 'Task', 'Test Suite', 'Test Plan', 'Test Case', 'Impediment')",
        "QueryBit": "AND  [Microsoft.VSTS.Common.ClosedDate] = '' AND [System.WorkItemType] IN ('Bug', 'Epic', 'Feature', 'Issue', 'Task', 'Test Case', 'Test Plan', 'Test Suite', 'User Story', 'Shared Parameter', 'Shared Steps' )",
          //"QueryBit": "AND  [Microsoft.VSTS.Common.ClosedDate] = '' AND [System.WorkItemType] IN ('Impediment' )",
        "OrderBit": "[System.ChangedDate] desc",
        "Enabled": true,
        "LinkMigration": true,
        "AttachmentMigration": true,
        "AttachmentWorkingPath": "c:\\temp\\WorkItemAttachmentWorkingFolder\\",
        "FixHtmlAttachmentLinks": false,
        "SkipToFinalRevisedWorkItemType": false,
        "WorkItemCreateRetryLimit": 5,
        "FilterWorkItemsThatAlreadyExistInTarget": true,
        "PauseAfterEachWorkItem": false,
        "AttachmentMazSize": 480000000,
        "CollapseRevisions": false
      }
    ]
  }

Migrated from: https://github.com/nkdAgility/azure-devops-migration-tools/issues/499


Solution

  • You should be able to remove the [Microsoft.VSTS.Common.ClosedDate] = '' condition from the QueryBit object of the WorkItemMigrationConfig processor. In your specific case, I would change the line to the following.

    "QueryBit": "AND [System.WorkItemType] IN ('Bug', 'Epic', 'Feature', 'Issue', 'Task', 'Test Case', 'Test Plan', 'Test Suite', 'User Story', 'Shared Parameter', 'Shared Steps' )",
    

    For someone using the default config, they would change it to the following.

    "QueryBit": "AND [System.WorkItemType] NOT IN ('Test Suite', 'Test Plan')",