diff --git a/src/ApiService/ApiService/onefuzzlib/notifications/Ado.cs b/src/ApiService/ApiService/onefuzzlib/notifications/Ado.cs index d79105e1d0..80ce2947a3 100644 --- a/src/ApiService/ApiService/onefuzzlib/notifications/Ado.cs +++ b/src/ApiService/ApiService/onefuzzlib/notifications/Ado.cs @@ -146,15 +146,19 @@ public async Async.Task Render(string template) { } } - public async IAsyncEnumerable ExistingWorkItems() { + public async IAsyncEnumerable ExistingWorkItems((string, string)[] notificationInfo) { var filters = new Dictionary(); foreach (var key in _config.UniqueFields) { var filter = string.Empty; if (string.Equals("System.TeamProject", key)) { filter = await Render(_config.Project); + } else if (_config.AdoFields.TryGetValue(key, out var field)) { + filter = await Render(field); } else { - filter = await Render(_config.AdoFields[key]); + _logTracer.WithTags(notificationInfo).Error($"Failed to check for existing work items using the UniqueField Key: {key}. Value is not present in config field AdoFields."); + continue; } + filters.Add(key.ToLowerInvariant(), filter); } @@ -327,7 +331,7 @@ private async Async.Task CreateNew() { } public async Async.Task Process((string, string)[] notificationInfo) { - var matchingWorkItems = await ExistingWorkItems().ToListAsync(); + var matchingWorkItems = await ExistingWorkItems(notificationInfo).ToListAsync(); var nonDuplicateWorkItems = matchingWorkItems .Where(wi => !IsADODuplicateWorkItem(wi))