Server Administration > Item Type Attributes > Creating Constraints > Working With Rule Constraints
Working With Rule Constraints
A rule constraint allows you to restrict the allowed value of a field when a specified rule is met (that is, the specified rule resolves to true). The rule method also applies for mandatory fields when the specified rule is met.
When working with rule constraints, the following fields are not available: modified user, created user, type, attachment fields, relationship fields, source project fields, and source link fields.
Key Fields and Concepts
Constrained Field is the field you are creating the constraint for. When this field is selected, only the values you select in the Allowed Values field will be allowed.
Allowed Values are the values you choose that will be the only ones allowed when the Constrained Field is selected.
When you copy a type, rule constraints are also copied.
Examples: Rule Constraints
The Flag for Review pick field has available values of Required and Not Required. To control the available states for an activity requiring a large effort, you could configure a rule to specify that if item’s state is Analyzed and the Effort field value is set to Large, then the value of the Flag for Review pick field will be limited to Required. Effectively this means that an activity that has been analyzed and requires a large effort, must be flagged for review.
In the next example, the rule constraint specifies that when the field Is Defect is true, the user must enter a value for Source Link Field, (thus Source Link Field becomes a mandatory field):
If (field["Is Defect"] = "true") then a value is required for "Source Link Field"
The next example shows a rule constraint that makes the Attachments field mandatory if the Assigned Group is the Administrator Group, or if the Assigned User is the administrator. With this rule, administrators will be required to add an attachment, such as a log file, when posting a defect item.