Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<rule name="AutoOpen" appliesTo="Task">
<!-- Update Work Item to Committed if a task became "active" -->
<![CDATA[
if (new[] {"In Progress", "To Do"}.Contains((string)self["System.State"]))
{
if(self.HasParent() && (string)self.Parent["System.State"] != "Committed")
{
self.Parent.TransitionToState("Committed", "Auto Activated");
}
}
]]>
</rule>
<rule name="AutoClose" appliesTo="Task">
<!-- Update Work Item to Done if a all child tasks are Done or Removed -->
<![CDATA[
if ((string)self["System.State"] == "Done" && self.HasParent() && ((string)self.Parent["System.State"]) != "Done")
{
if (self.Parent.Children.All(child => new[] {"Removed", "Done"}.Contains((string)child["System.State"])))
{
self.Parent.TransitionToState("Done", "Auto done");
}
}
]]>
</rule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment