Work Item rules workaround: Saving the resolved reason

In our last post in this series, Gregg blogged about securing a work item type. Another question along these lines: “How can I save the resolved reason? I want to create metrics based on how bugs were resolved, but the value of the ‘Reason’ field is changed when the bug is closed”

Here’s the solution:

1. Add “Microsoft.VSTS.Common.ResolvedReason” field to the form definition

2. Add the following rules to the workflow transition from “Active” to “Resolved”

<Transition from="Active" to="Resolved">
   <REASONS>
    <REASON value="Fixed">
      <FIELDS>
        <FIELD refname="Microsoft.VSTS.Common.ResolvedReason">
          <COPY from="value" value="Fixed" />
        </FIELD>
      </FIELDS>
    </REASON>
    <REASON value="Deferred">
      <FIELDS>
        <FIELD refname="Microsoft.VSTS.Common.ResolvedReason">
          <COPY from="value" value="Deferred" />
        </FIELD>
       </FIELDS>
    </REASON>
    ...
</Transition>

Here’s the end result; I am displaying the field in the Details tab of the Bug form:

image

This workaround works by copying the resolved reason when the bug is resolved off into the Resolved Reason field.

Sunder Raman

Program Manager, Team Foundation Server

[Cross-posted from https://blogs.msdn.com/sunder/]