Skip to content

Instantly share code, notes, and snippets.

@tomkuijsten
Last active January 15, 2016 14:39
Show Gist options
  • Save tomkuijsten/c090269308cc86968206 to your computer and use it in GitHub Desktop.
Save tomkuijsten/c090269308cc86968206 to your computer and use it in GitHub Desktop.
<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