Export (0) Print
Expand All

Using the <WHEN*>, <DEFAULT>, and <COPY> Rules

This section describes the expected behavior and interactions when using the <DEFAULT>, <COPY>, and <WHEN*> rules. The following steps show, in proper sequence, interactions that are performed by Team Foundation Server and by the user of a work-item form. Only steps 1, 8, and 13 are performed by a user.

  1. Using the Visual Studio user interface, a user takes action to create a new work item or edit an existing work item.

  2. Fill in field defaults. For all fields, use any <DEFAULT> rules which are outside <WHEN*> rules.

  3. Copy field values. For all fields, use any <COPY> rules which are outside <WHEN*> clauses.

  4. For all fields with a <WHEN> rule that matches, first do <DEFAULT> and then <COPY> rules inside.

  5. For all fields with a <WHENNOT> rule that matches, first do <DEFAULT> and then <COPY> rules inside.

    NoteNote:

    The Team Foundation Server always process <WHEN> rules before <WHENNOT> rules.

  6. For all fields that have had their values changed since step 1 and that contain <WHENCHANGED> rules, first do <DEFAULT> and then <COPY> rules inside.

  7. Allow the user to start editing.

  8. The user changes a field value and then moves focus from the field.

  9. Raise any <WHEN> rules for that field that match the new value.

  10. Raise any <WHENNOT> rules for that field that match the new value.

  11. Raise any <WHENCHANGED> rules for that field that match the new value

  12. Return editing ability to the user.

  13. The user takes action to save the changes to the database.

  14. For all fields, perform <SERVERDEFAULT> operations that are defined for the field either directly or indirectly under a <WHEN> or <WHENNOT> rule.

When a user uses the graphical user interface to edit a work-item form, a new value is set each time a keystroke is entered for a field. This means that a <WHEN* rule can occur unexpectedly whenever the rule’s prerequisite conditions are met.

In the following XML example, SubStatus will be emptied as you type "Approved Again" into the Status field because the <WHEN*> rule occurs as soon as the user types the letter "e" in Approved, even if the intended final value is not "Approve." For this reason, give careful consideration when using conditional rules.

<FIELD refname="MyCorp.SubStatus" />
<WHEN field="MyCorp.Status" value="Approve" >
<EMPTY />
</WHEN>
</FIELD>

Community Additions

ADD
Show:
© 2014 Microsoft