Skip to content

Parallelism and multiple rules triggered on work item changed #254

Answered by giuliov
marnheus asked this question in Q&A
Discussion options

You must be logged in to vote

Great question.
You must be careful to avoid cycles and loops: this version has no check for an infinite loop (it was possible with TfsAggregator because rules share the process memory).

Events

Let's start from the event that triggers a rule.
The workitem.created has no dependency on other rules but Azure DevOps may send it after a workitem.updated event!
The workitem.updated event has an additional selfChanges parameter and you should use to write a guard.

string magic = " - APPENDED";
if (selfChanges.Fields.ContainsKey("System.Title")) {
  // check it is not recursion
  var titleUpdate = selfChanges.Fields["System.Title"];
  if (!titleUpdate.NewValue.Contains(magic)) {
    self.Title = t…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@marnheus
Comment options

Answer selected by marnheus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants