views:

25

answers:

1

I'm trying to add a custom workitemtype to TFS.

I would like to have a field called SignOff, with possible values of Yes/No. Next to that I would like to have a field called SignOffBy - when you change the SignOff field the SignOffBy field should be set to the current user.

  <FIELD name="Signoff" refname="MyProj.Signoff" type="String" >
    <ALLOWEDVALUES expanditems="true">
      <LISTITEM value="Yes" />
      <LISTITEM value="No" />
      </ALLOWEDVALUES>
      <DEFAULT from="value" value="No" />
  </FIELD>
  <FIELD name="Signoff By" refname="MyProj.SignoffBy" type="String" >       
    <WHENCHANGED field="MyProj.Signoff">
      <DEFAULT from="currentuser" />
    </WHENCHANGED>
    <WHENNOTCHANGED field="MyProj.SsoSignoff">
        <READONLY />
        <EMPTY />
      </WHENNOTCHANGED>
  </FIELD>

The problem seems to be that the SignOffBy field wants to be populated at all times. If I don't use the empty tag it just gets populated right away. I want it to be blank, but only get populated when the field gets changed. At the moment it's not changing at all - it's just blank and stays blank.

A: 

Instead of onchanged rules, have a WHEN rule for signoff being false, and set the field to EMPTY/READONLY as you currently do. Have a second WHEN rule for the true case, and use a COPY rule to copy the currentuser value into the field instead of doing it via a DEFAULT rule.

Richard Banks
Already figured this out, but I did exactly what you suggested. Thanks
Jaco Pretorius