> ## Documentation Index
> Fetch the complete documentation index at: https://docs.serval.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Rules

> Govern how items in a database change with required values and workflows. Set at the table level using the Rules tab.

Every database has a **Rules** tab, where you govern how items in that table change. You can configure rules manually, or use Catalyst.

When you create a rule, you choose what it does.

* **Validation**: Require values and block changes unless they meet specific requirements. Useful for keeping records complete and consistent. Examples include requiring a field to match a specific format like text, or stay within a specific numerical range.
* **Workflow**: Trigger a workflow before or after saving a change:
  * **Run a workflow before saving**: a workflow outcome determines if the change is saved. The change is held until the workflow completes. The workflow either accepts or rejects the change, or fails. On rejection or failure, a database issue is opened. For example, trigger a workflow that requires approvals before a record is deleted.
  * **Run a workflow after saving**: a workflow runs once a change is saved, but doesn't block the change. Instead, on a failure, a database issue is opened. For example, update a related record whenever an item changes.
* **Normalization**: Normalize and map inconsistent entries to a canonical value. Useful for standardizing messy data. For example, map "Acme Incorporated", "ACME", and "Acme Inc." to a single vendor "Acme", and normalize all mapped entries in the table accordingly.

## Create a rule

You can create a rule manually or with Catalyst.

### Catalyst

In a Catalyst chat, describe the rule you want to create using plain language. For example, ask Catalyst to "create a rule that requires an owner to be set before a device can be marked as in use". For more information, see [Building with Catalyst](/sections/documentation/catalyst/overview).

### Manually

1. In **Databases**, open the table you want to add a rule to.
2. On the table, open the **Rules** tab
3. Select **Create Rule**.
4. In the dropdown, select the rule type: **Validation**, **Workflow**, or **Normalization**. Configuration options vary depending on selected rule type.

## Rule types and configuration options

The available configuration options vary by rule type.

### Validation and workflow

When **Validation** or **Workflow** is the selected rule type, you can configure the following:

* **Check on** determines the rule type. A **Require values** rule applies to any create, update, or unarchive operations. A **workflow** rule can also cover archive and deletion.
* **Only apply when** is an optional setting that sets conditions that must match for a rule to run, or the rule is skipped.
* **Then** determines the effect, depending on the rule type selected.
  * **Require values**: add conditions that the item must satisfy, and add an error message to display when the change is blocked. Conditions can test whether a field changed, compare a field to a value or to another field, match a regular expression, or check a numeric range, combined with AND or OR.
  * **Workflow**: select the workflows to run, and optionally set the workflow version.

### Normalization

When **Normalization** is the selected rule type, the **New normalization rule** dialog opens, and you can configure the following:

* **Raw value**: the field to normalize.
* **Maps to**: the canonical value to resolve to.
* Optionally, run the rule on existing records.

## Good to know

* Validation and workflow rules apply after they're created, but don't scan already existing items. Normalization rules can be optionally run on existing records after the rule is created.
* Rules are set at the table level.
* Permissions vary by Serval role and the type of action being performed.
  * **Viewing a rule** requires read-only roles or higher.
  * **Creating, enabling, editing and deleting rules** requires a Builder role or higher.
* The **Rules** tab is hidden on tables shared from another team, and for roles that can't view tables.

## Related

* [Schema](/sections/documentation/databases/schema-design)
* [Issues](/sections/documentation/databases/issues)
* [Workflows](/sections/documentation/workflows/overview)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.