2
votes

On vs2013: tools > process editor > work item types > open WIT from server.

By editing the Task work item rules, I have come out with the following xml item definition:

<FieldDefinition name="Remaining Work" refname="Microsoft.VSTS.Scheduling.RemainingWork" type="Double" reportable="measure">
  <WHENCHANGED field="Microsoft.VSTS.Scheduling.OriginalEstimate">
    <COPY for="[global]\Project Collection Valid Users" from="field" field="Microsoft.VSTS.Scheduling.OriginalEstimate" />
  </WHENCHANGED>
</FieldDefinition>

What I am trying to achieve is sth more like this:

<FieldDefinition name="Remaining Work" refname="Microsoft.VSTS.Scheduling.RemainingWork" type="Double" reportable="measure">
  <WHENCHANGED field="Microsoft.VSTS.Scheduling.OriginalEstimate">
    <WHEN field="Microsoft.VSTS.Scheduling.RemainingWork" value="">
        <COPY for="[global]\Project Collection Valid Users" from="field" field="Microsoft.VSTS.Scheduling.OriginalEstimate" />
    </WHEN>
  </WHENCHANGED>
</FieldDefinition>

The problem is what I have now is not working for me (whenever I change Original Estimate, Remaining Work is not being updated), and I can't figure out how to stick in the WHEN clause.

2

2 Answers

2
votes

I finally changed the Task tfs field definition for my project, via witadmin export/import:

On a Developer Command Prompt for VS2013

> witadmin exportwitd /collection:http://myTFSserver:8080/tfs/DefaultCollection /p:myTFSProject /n:Task /f:"c:\tfs\Task.xml"

replace the relevant section on Task.xml

  <FIELD name="Remaining Work" refname="Microsoft.VSTS.Scheduling.RemainingWork" type="Double" reportable="measure" formula="sum">
    <WHENCHANGED field="Microsoft.VSTS.Scheduling.OriginalEstimate">
      <COPY for="[global]\Project Collection Valid Users" from="field" field="Microsoft.VSTS.Scheduling.OriginalEstimate" />
    </WHEN>
  </FIELD>

with

  <FIELD name="Remaining Work" refname="Microsoft.VSTS.Scheduling.RemainingWork" type="Double" reportable="measure" formula="sum">
    <WHEN field="Microsoft.VSTS.Scheduling.RemainingWork" value="">
      <COPY from="field" field="Microsoft.VSTS.Scheduling.OriginalEstimate" />
    </WHEN>
  </FIELD>

then convey the change

> witadmin importwitd /collection:http://myTFSserver:8080/tfs/DefaultCollection /p:myTFSProject /f:"c:\tfs\Task.xml"
0
votes

I can't think of a way to do what you want with just WITD.

Another (more complex) option is to create an ISubscriber plug-in that you deploy to your TFS. It can detect whenever your work items are changed and update fields appropriately using any logic you can write in C#.