WHENCHANGED Element (Work Item Type Definition Schema)
Specifies one or more rules to apply to the current field when the value of another field changes. The parent element defines the current field.
<WHENCHANGED field="field reference name"> <REQUIRED>…</REQUIRED> <READONLY>…</READONLY> <EMPTY>…</EMPTY> <FROZEN>…</FROZEN> <CANNOTLOSEVALUE>…</CANNOTLOSEVALUE> <NOTSAMEAS>…</NOTSAMEAS> <VALIDUSER>…</VALIDUSER> <ALLOWEXISTINGVALUE>…<ALLOWEXISTINGVALUE> <MATCH>…</MATCH> <ALLOWEDVALUES>…</ALLOWEDVALUES> <SUGGESTEDVALUES>…</SUGGESTEDVALUES> <PROHIBITEDVALUES>…</PROHIBITEDVALUES> <DEFAULT>…</DEFAULT> <COPY>…</COPY> <SERVERDEFAULT>…</SERVERDEFAULT> </WHENCHANGED>
The following sections describe the attribute and child elements that define the WHENCHANGED element. They also describe parent elements that define how the WHENCHANGED element is applied. You must define at least one child element.
Attributes
| Attribute | Description |
|---|---|
| field | Required attribute. When the value of the specified field changes, the rules in this element are applied to the current field. You specify this attribute by the field reference name. For more information about reference names, see FIELD Element (WORKITEMTYPE Element). |
Child Elements
| Element | Description |
|---|---|
| REQUIRED | Optional element. When the value of the specified field changes, the current field must have a value. |
| READONLY | Optional element. When the value of the specified field changes, the current field is read-only. |
| EMPTY | Optional element. When the value of the specified field changes, the current field must be empty. |
| FROZEN | Optional element. When the value of the specified field changes, the current field is frozen. When a field is frozen, you can change its value to NULL, but you cannot change its value to any other value. |
| CANNOTLOSEVALUE | Optional element. When the value of the specified field changes, you can change the value of the current field to NULL, but you cannot change it to any other value. |
| NOTSAMEAS | Optional element. When the value of the specified field changes, the value of the current field cannot match the value of a third field. You specify the third field in the NOTSAMEAS element. |
| VALIDUSER | Optional element. When the value of the specified field changes, only the specified users can modify the field. |
| ALLOWEXISTINGVALUE | Optional element. When the value of the specified field changes, the value of the current field that already exists will be allowed, even if it violates other rules. If the value of the current field is changed, this element does not apply. |
| MATCH | Optional element. When the value of the specified field changes, the value of the current field must match the specified pattern. |
| ALLOWEDVALUES | Optional element. When the value of the specified field changes, the current field must have a value that comes from the specified list of values. |
| SUGGESTEDVALUES | Optional element. When the value of the specified field changes, the specified list contains suggested values for the current field. |
| PROHIBITEDVALUES | Optional element. When the value of the specified field changes, the current field cannot contain any values in this list. |
| DEFAULT | Optional element. When the value of the specified field changes, the specified value is the default value for the current field. |
| COPY | Optional element. When the value of the specified field changes, the value from a third field is automatically copied into the current field. You specify the third field in the COPY element. |
| SERVERDEFAULT | Optional element. When the value of the specified field changes, the current field takes its value from the specified server component. The server components are clock, which is the time when the work item is updated, and currentuser, which is the identity that updated the work item. |
Parent Elements
| Element | Description |
|---|---|
| FIELD (Work Item Type Definition Schema) | Required element. References a work item field definition and the rules and conditions that apply to the field. The reference is based on the STATE, TRANSITION, DEFAULTREASON, or REASON element that its parent FIELDS element is a child of. |
| FIELD (WORKITEMTYPE element) | Required element. Defines a work item field and specifies the rules and conditions that apply to it. |