Skip to content

Commit ba9a5ad

Browse files
authored
Skip closedDate field validation when closedDate field doesn't exist
Handle case where there is no closed date field in target workitem. For us it didn't work for Shared paramter. We cannot modify shared parameter workitem in azure devops. Skip field didn't work.
1 parent e4a2555 commit ba9a5ad

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/MigrationTools.Clients.TfsObjectModel/Processors/TfsWorkItemMigrationProcessor.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,12 @@ private void CheckClosedDateIsValid(WorkItemData sourceWorkItem, WorkItemData ta
895895
{
896896
closedDateField = "Microsoft.VSTS.Common.ClosedDate";
897897
}
898+
else if (!targetWorkItem.ToWorkItem().Fields.Contains("System.ClosedDate"))
899+
{
900+
Log.LogDebug("CheckClosedDateIsValid::ClosedDate field doesn't exist in targetWorkItem: {targetWorkItem} - nothing to validate.", targetWorkItem);
901+
return;
902+
}
903+
898904
Log.LogDebug("CheckClosedDateIsValid::ClosedDate field is {closedDateField}", closedDateField);
899905
if (targetWorkItem.ToWorkItem().Fields[closedDateField].Value == null && (targetWorkItem.ToWorkItem().Fields["System.State"].Value.ToString() == "Closed" || targetWorkItem.ToWorkItem().Fields["System.State"].Value.ToString() == "Done"))
900906
{
@@ -921,7 +927,6 @@ private void CheckClosedDateIsValid(WorkItemData sourceWorkItem, WorkItemData ta
921927
Log.LogWarning("Target ClosedDate Field: ", "System.ClosedDate");
922928
}
923929
}
924-
925930
}
926931

927932
private bool SkipRevisionWithInvalidIterationPath(WorkItemData targetWorkItemData)

0 commit comments

Comments
 (0)