> For the complete documentation index, see [llms.txt](https://help.glpi-project.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.glpi-project.org/glpi-12/administration/rules.md).

# Rules

## What is a rule in GLPI?

There are several types of rules in GLPI. Rules are used to automate and simplify certain tasks. For example, you can assign an item to an entity during an inventory upload, grant authorizations to a user when they log in, or assign a ticket through a mail receiver.

***

## How do rules work?

Rules in GLPI are made up of **criteria** and **actions**. They allow you to automate processing based on specific conditions.

**Example: assigning authorizations to a user**

Suppose you want to automatically assign a profile and an entity to certain users:

**Criteria:**

1. The authentication type is **external** (other than the internal database or LDAP).
2. The user ID contains `@mydomain.com`.

**Actions:**

1. Assign the **Self-Service profile**.
2. Assign **entity A**.
3. Enable **recursive** on this assignment.

***

## The different rules

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><h4><i class="fa-cloud-arrow-down">:cloud-arrow-down:</i></h4></td><td><strong>Inventory rules</strong></td><td><a href="https://help.glpi-project.org/glpi-12/administration/rules/inventory-rules.md">Inventory rules</a></td></tr><tr><td><h4><i class="fa-user-check">:user-check:</i></h4></td><td><strong>Authorizations assignment rules</strong></td><td><a href="https://help.glpi-project.org/glpi-12/administration/rules/authorizations-assignment-rules.md">Authorizations assignment rules</a></td></tr><tr><td><h4><i class="fa-grid-2-plus">:grid-2-plus:</i></h4></td><td><strong>Rules for assigning a category to software</strong></td><td><a href="https://help.glpi-project.org/glpi-12/administration/rules/rules-for-assigning-a-category-to-software.md">Rules for assigning a category to software</a></td></tr><tr><td><h4><i class="fa-circle-exclamation">:circle-exclamation:</i></h4></td><td><strong>Business rules for tickets</strong></td><td><a href="https://help.glpi-project.org/glpi-12/administration/rules/business-rules-for-tickets.md">Business rules for tickets</a></td></tr><tr><td><h4><i class="fa-clipboard-check">:clipboard-check:</i></h4></td><td><strong>Business rules for changes and problems</strong></td><td><a href="https://help.glpi-project.org/glpi-12/administration/rules/business-rules-for-changes-and-problems.md">Business rules for changes and problems</a></td></tr><tr><td><h4><i class="fa-empty-set">:empty-set:</i></h4></td><td><strong>Blacklists</strong></td><td><a href="https://help.glpi-project.org/glpi-12/administration/rules/blacklist.md">Blacklist</a></td></tr></tbody></table>

***

## Which operators are available in criteria?

In GLPI rules, you need to use operators to build your rule. For example, if login **`contains`** @mydomain.com or if group **`is`** infrastructure. A number of operators are available so you can create your rules as explicitly and logically as possible.

These operators allow you to build precise rules adapted to your needs and to your organization's structure.

Depending on the selected criterion, the operators offered by GLPI may vary.

<table><thead><tr><th>Operators</th><th width="198">Description</th><th width="97">Input value</th><th width="263">Example (field - operator - pattern)</th><th>Result</th></tr></thead><tbody><tr><td><strong>is</strong></td><td>True if the value is strictly equal to the criterion (case-insensitive).</td><td><code>Dell</code></td><td><code>Manufacturer</code> <code>is</code> <code>Dell</code></td><td>✅</td></tr><tr><td><strong>is not</strong></td><td>True if the value is different from the criterion.</td><td><code>HP</code></td><td><code>Manufacturer</code> <code>is not</code> <code>Dell</code></td><td>✅</td></tr><tr><td><strong>contains</strong></td><td>True if the value contains the criterion as a substring.</td><td><code>HP LaserJet</code></td><td><code>Type</code> <code>contains</code> <code>Laser</code></td><td>✅</td></tr><tr><td><strong>does not contain</strong></td><td>True if the value does not contain the criterion.</td><td><code>HP LaserJet</code></td><td><code>Type</code> <code>does not contain</code> <code>Dell</code></td><td>✅</td></tr><tr><td><strong>starting with</strong></td><td>True if the value starts with the criterion.</td><td><code>GLPI-123</code></td><td><code>Name</code> <code>starting with</code> <code>GLPI</code></td><td>✅</td></tr><tr><td><strong>finished by</strong></td><td>True if the value ends with the criterion.</td><td><code>PC-01</code></td><td><code>Name</code> <code>finished by</code> <code>01</code></td><td>✅</td></tr><tr><td><strong>regular expression matches</strong></td><td>True if the value matches the given regular expression.</td><td><code>GLPI-2025</code></td><td><code>Name</code> <code>regular expression matches</code> <code>/GLPI-\d+/</code></td><td>✅</td></tr><tr><td><strong>regular expression does not match</strong></td><td>True if the value does <strong>not</strong> match the given regular expression.</td><td><code>GLPI-ABC</code></td><td><code>Name</code> <code>regular expression does not match</code> <code>/\d+/gm</code></td><td>✅</td></tr><tr><td><strong>exists</strong></td><td>Checks whether the field is present in the data sent to the engine, regardless of its content.</td><td><code>Description</code></td><td><code>name</code> <code>exists</code> <code>yes</code></td><td>✅</td></tr><tr><td><strong>does not exist</strong></td><td>Checks whether the field is absent from the data sent to the engine.</td><td><code>Description</code></td><td><code>ghost_field</code> <code>does not exist</code> <code>yes</code></td><td>✅</td></tr><tr><td><strong>under</strong></td><td>Checks whether an item (e.g. entity, category) is a child or descendant of a given parent in the GLPI hierarchy.</td><td><code>Paris</code></td><td><code>Entity</code> <code>under</code> <code>France</code></td><td>✅</td></tr><tr><td><strong>not under</strong></td><td>Checks whether an item (e.g. entity, category) is not a descendant of the specified parent.</td><td><code>Lyon</code></td><td><code>Entity</code> <code>not under</code> <code>Paris</code></td><td>✅</td></tr><tr><td><strong>is empty</strong></td><td>True if the field is empty.</td><td></td><td><code>Name</code> <code>is empty</code> <code>yes</code></td><td>✅</td></tr><tr><td><strong>is CIDR</strong></td><td>True if the IP address belongs to the given subnet.</td><td><code>192.168.1.5</code></td><td><code>IP</code> <code>is CIDR</code> <code>192.168.1.0/24</code></td><td>✅</td></tr><tr><td><strong>is not CIDR</strong></td><td>True if the IP address does not belong to the given subnet.</td><td><code>10.0.0.1</code></td><td><code>IP</code> <code>is not CIDR</code> <code>192.168.1.0/24</code></td><td>✅</td></tr><tr><td><strong>Date is before</strong></td><td>True if the date is strictly earlier than the criterion.</td><td><code>2025-01-01</code></td><td><code>Date</code> <code>Date is before</code> <code>2025-06-01</code></td><td>✅</td></tr><tr><td><strong>Date is after</strong></td><td>True if the date is strictly later than the criterion.</td><td><code>2025-12-01</code></td><td><code>Date</code> <code>Date is after</code> <code>2025-06-01</code></td><td>✅</td></tr><tr><td><strong>Date is equal</strong></td><td>True if the date is exactly equal to the criterion.</td><td><code>2025-09-26</code></td><td><code>Date</code> <code>Date is equal</code> <code>2025-09-26</code></td><td>✅</td></tr><tr><td><strong>Date is not equal</strong></td><td>True if the date is different from the criterion.</td><td><code>2025-09-25</code></td><td><code>Date</code> <code>Date is not equal</code> <code>2025-09-26</code></td><td>✅</td></tr><tr><td><strong>is already present</strong></td><td>True if already present</td><td></td><td></td><td></td></tr></tbody></table>

### Special cases

**Regex in the GLPI rule engine**

**Expected format:**

* The `pattern` field must contain a **valid PHP regular expression**, enclosed in `/`.
  * Correct example: `/GLPI-(\d+)/`
* The expression is automatically completed with the `si` *flags*:
  * s: Enables "dotall" mode, which allows the dot `.` to also match the line break character `\n`.
  * **i**: case-insensitive.
* Example pattern: `/GLPI-(\d+)/` becomes `/GLPI-(\d+)/si` when evaluated.

**How it works:**

1. The engine runs a `preg_match_all` on the field value with the pattern.
2. If one or more matches are found:
   * Each captured group is retrieved and added to the `$regex_result` array.
3. If no match is found, the criterion is evaluated as `false`.

**Multiple capture groups:**

* You can use several sets of parentheses in the pattern to capture several sub-values.
* These values can then be retrieved in the **"Assign the value from the regular expression"** action.
* Captured groups are accessible with `#0`, `#1`, `#2`, etc., depending on their order in the pattern.

**Example:**

* Pattern: `/GLPI-(\d+)-([A-Z]+)/`
* Field: `GLPI-123-ABC`
* Result in `$regex_result`:
  * `#0` = `123`
  * `#1` = `ABC`

***

## Which actions are available?

In GLPI, **actions** define what should happen when a rule is triggered. They allow you, for example, to:

* **Modify** an existing field
* **Assign a value** to a dropdown
* **Add a value** to a field
* **Delete the value** of a field

These actions are executed automatically as soon as the rule's conditions are met, which makes it possible to **automate the processing** of items and ensure **consistent and efficient management**.

Depending on the selected field, the actions offered by GLPI may vary.

<table data-search="false"><thead><tr><th>Actions</th><th>Description</th><th>Example (field - action - value)</th></tr></thead><tbody><tr><td><strong>Assign</strong></td><td>Sets / replaces the value of a field</td><td><code>Location</code> <code>Assign</code> <code>Paris</code></td></tr><tr><td><strong>Add</strong></td><td>Adds the value to an existing list</td><td><code>Requester</code> <code>Add</code> <code>John Doe</code></td></tr><tr><td><strong>Assign the value from the regular expression</strong></td><td>Assigns / replaces the value extracted from a regular expression</td><td><code>Entity from TAG</code> <code>Assign the value from the regular expression</code> <code>#0</code></td></tr><tr><td><strong>Add the result of regular expression</strong></td><td>Adds the result of the regular expression</td><td><code>Operating system version</code> <code>Add the result of regular expression</code> <code>#1</code></td></tr><tr><td><strong>Assign: equipment by IP address</strong></td><td>Assigns a piece of equipment based on its IP address</td><td><code>Associated element</code> <code>Assign: equipment by IP address</code> <code>192.168.1.10</code></td></tr><tr><td><strong>Assign: equipment by FQDN</strong></td><td>Assigns a piece of equipment based on its FQDN</td><td><code>Associated element</code> <code>Assign: equipment by FQDN</code> <code>server1.example.com</code></td></tr><tr><td><strong>Assign: equipment by MAC</strong></td><td>Assigns a piece of equipment based on its MAC address</td><td><code>Associated element</code> <code>Assign: equipment by MAC</code> <code>00:37:6C:E2:EB:62</code></td></tr><tr><td><strong>Recalculate</strong></td><td>Automatically recalculates a value</td><td><code>Priority</code> <code>Recalculate</code></td></tr><tr><td><strong>Delete</strong></td><td>Deletes the value of the field</td><td><code>Time to resolve</code> <code>Delete</code></td></tr><tr><td><strong>Do not calculate</strong></td><td>Prevents the automatic calculation of a field</td><td><code>Time to own</code> <code>Do not calculate</code></td></tr><tr><td><strong>Send</strong></td><td>Sends a notification</td><td><code>Automatic reminders of SLAs</code> <code>Send</code> <code>Yes</code></td></tr><tr><td><strong>Send a validation request</strong></td><td>Sends a validation request</td><td><code>Send a validation request - User</code> <code>Send</code> <code>John Doe</code></td></tr><tr><td><strong>Copy from user</strong></td><td>Copies the value from the user</td><td><code>Location</code> <code>Copy from user</code></td></tr><tr><td><strong>Copy default from user</strong></td><td>Copies the default value from the user</td><td><code>Group</code> <code>Copy default from user</code></td></tr><tr><td><strong>Copy first group from user</strong></td><td>Copies the user's first group</td><td><code>Group</code> <code>Copy first group from user</code></td></tr><tr><td><strong>Copy from item</strong></td><td>Copies the value from an associated item</td><td><code>Technician group</code> <code>Copy from item</code></td></tr></tbody></table>

***

### Import / Export

Export, import and duplication are possible for all rules. These operations can be performed globally from the main rules page, or in bulk from the search engines of the various rules via massive actions. These features are useful, for example, when moving rules from a pre-production environment to a production environment.

{% hint style="info" %}
Export and import use an XML file format
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.glpi-project.org/glpi-12/administration/rules.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
