# Field rules

### Field rules in aqua

Field rules let you control how fields behave depending on the values selected in the controlling fields.\
This functionality helps you build logic into your projects — making it easier to guide users, enforce consistency, and automate field behavior.

**Field rules** can be applied to:

* Requirements
* Test cases
* Test scenarios
* Defects

{% hint style="warning" %}
Currently, field rules work only with **single-select fields** (either default or custom ones).

Default 'Status' field can't be used with field rules as it's used to define [Workflow](/documentation/project-configuration/workflow-configuration.md)
{% endhint %}

#### Types of field rules

Field rules consist of two main parts: **Restrictions** and **Actions**.

### **Restrictions**

Restrictions define which values are available in one field depending on the value selected in another field.\
They help narrow down options for users or prevent invalid combinations.

**Example**

Let’s say you have **a requirement** where there are two single-select fields:

* **Field name: Field A**\
  Field values: Item 1, Item 2, Item 3, Item 4, Item 5
* **Field name: Field B**\
  Field values: Option 1, Option 2, Option 3, Option 4, Option 5

**You can create a rule like this:**

* If **Field B** value equals Option 1, show only *Item 1* and *Item 2* in **Field A**
* If **Field B** value equals Option 2, show only *Item 3* and *Item 4* in **Field A**
* If **Field B** value equals  Option 3, show *Item 1* and *Item 5* in **Field A**

<figure><img src="/files/UpHGXYvQRVD2Da68GuZn" alt=""><figcaption></figcaption></figure>

If no rule is set, it would look like this. Disregarding the selected item in Field B, Field A has a full list of values

<figure><img src="/files/It8gNqAyZfeOvteytZv1" alt=""><figcaption></figcaption></figure>

If a rule is set, then **the Field A** will have a list of values that are controlled by the value from **the Field B** as per defined rule.

<figure><img src="/files/QPmR1fj05CtAzBSHWr4D" alt=""><figcaption></figcaption></figure>

You can define multiple restrictions for different combinations of fields.

To set up a Restriction rule, do the following steps:

* Create single select fields in the [template](/documentation/project-configuration/project-template-configuration-fields.md) for your item type if you don't plan to use default only.
* Select project and navigate to the **Field rules**

<figure><img src="/files/VzuxFyV4nBIOnE5S8V34" alt=""><figcaption></figcaption></figure>

* Select item type and then a field that will be affected

<figure><img src="/files/FuU4CJxvxSWnTNjAmjzE" alt=""><figcaption></figcaption></figure>

* Then controlling field

<figure><img src="/files/iOvAjYbSNjcKA7SfzZDw" alt=""><figcaption></figcaption></figure>

* Then select the value from the controlling field

<figure><img src="/files/tViNjzZrZ3GVSL5yERKQ" alt=""><figcaption></figcaption></figure>

* Then values for the affected field that will be shown

<figure><img src="/files/xQPhcA2w1uQSUdxP31YN" alt=""><figcaption></figcaption></figure>

* Save changes

<figure><img src="/files/LM2snoiFZEPMWuGzn9wm" alt=""><figcaption></figcaption></figure>

### **Actions**

Actions define how a field should behave based on the value selected in another field.

The are following action rules that be can defined:

* Set value
* Required
* Read-only
* Highlight
* Visible/Hidden

**For example:**

* If the **Field A** value equals *Item 1,* then **the Field B** will be **Required**\
  ![](/files/RR6nrfupch5DiVXZniFL)

<figure><img src="/files/bJ7y8BHDRQeQyA0iTJ1O" alt=""><figcaption></figcaption></figure>

This allows you to dynamically adjust forms depending on context.

**Actions** set up

* Go to Project Configuration → Field Rules.
* Select the item and then the controlling field (the field whose value triggers the rule).
* The select the rule ‘Actions’.
* Once you select ‘Actions’, then click 'Add new action’’ and select the controlling from the dropdown that will affect another field.

<figure><img src="/files/1RZHn68EFyXq4pQMfCWY" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/ef43CR3qDNH45xfm1U2v" alt=""><figcaption></figcaption></figure>

* Then select the affected field.

<figure><img src="/files/UA5MbLS9WZhAu57e1DcK" alt=""><figcaption></figcaption></figure>

* Define the desired logic and behavior by checking one or multiple checkboxes: **set value, required, read-only, highlight, visible.**

<figure><img src="/files/2sUYLv6h1UyFwS0RxkaO" alt=""><figcaption></figcaption></figure>

* Click **Save** to apply changes.

{% hint style="info" %}
Please note:

* When you select ‘Set value’, you can define a default value that will always be applied.
* The ‘Visible’ option is enabled by default. If you want to hide the field, simply uncheck it.
* The ‘Visible’ option is automatically checked whenever a field is set as required.
  {% endhint %}

Furthermore, field values from single-select fields with shared value sets can be set automatically when creating dependent items or creating defects from test executions.&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aqua-cloud.io/documentation/project-configuration/field-rules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
