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:
The authentication type is external (other than the internal database or LDAP).
The user ID contains
@mydomain.com.
Actions:
Assign the Self-Service profile.
Assign entity A.
Enable recursive on this assignment.
The different rules
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.
is
True if the value is strictly equal to the criterion (case-insensitive).
Dell
Manufacturer is Dell
✅
is not
True if the value is different from the criterion.
HP
Manufacturer is not Dell
✅
contains
True if the value contains the criterion as a substring.
HP LaserJet
Type contains Laser
✅
does not contain
True if the value does not contain the criterion.
HP LaserJet
Type does not contain Dell
✅
starting with
True if the value starts with the criterion.
GLPI-123
Name starting with GLPI
✅
finished by
True if the value ends with the criterion.
PC-01
Name finished by 01
✅
regular expression matches
True if the value matches the given regular expression.
GLPI-2025
Name regular expression matches /GLPI-\d+/
✅
regular expression does not match
True if the value does not match the given regular expression.
GLPI-ABC
Name regular expression does not match /\d+/gm
✅
exists
Checks whether the field is present in the data sent to the engine, regardless of its content.
Description
name exists yes
✅
does not exist
Checks whether the field is absent from the data sent to the engine.
Description
ghost_field does not exist yes
✅
under
Checks whether an item (e.g. entity, category) is a child or descendant of a given parent in the GLPI hierarchy.
Paris
Entity under France
✅
not under
Checks whether an item (e.g. entity, category) is not a descendant of the specified parent.
Lyon
Entity not under Paris
✅
is empty
True if the field is empty.
Name is empty yes
✅
is CIDR
True if the IP address belongs to the given subnet.
192.168.1.5
IP is CIDR 192.168.1.0/24
✅
is not CIDR
True if the IP address does not belong to the given subnet.
10.0.0.1
IP is not CIDR 192.168.1.0/24
✅
Date is before
True if the date is strictly earlier than the criterion.
2025-01-01
Date Date is before 2025-06-01
✅
Date is after
True if the date is strictly later than the criterion.
2025-12-01
Date Date is after 2025-06-01
✅
Date is equal
True if the date is exactly equal to the criterion.
2025-09-26
Date Date is equal 2025-09-26
✅
Date is not equal
True if the date is different from the criterion.
2025-09-25
Date Date is not equal 2025-09-26
✅
is already present
True if already present
Special cases
Regex in the GLPI rule engine
Expected format:
The
patternfield must contain a valid PHP regular expression, enclosed in/.Correct example:
/GLPI-(\d+)/
The expression is automatically completed with the
siflags: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+)/siwhen evaluated.
How it works:
The engine runs a
preg_match_allon the field value with the pattern.If one or more matches are found:
Each captured group is retrieved and added to the
$regex_resultarray.
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-ABCResult 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.
Assign
Sets / replaces the value of a field
Location Assign Paris
Add
Adds the value to an existing list
Requester Add John Doe
Assign the value from the regular expression
Assigns / replaces the value extracted from a regular expression
Entity from TAG Assign the value from the regular expression #0
Add the result of regular expression
Adds the result of the regular expression
Operating system version Add the result of regular expression #1
Assign: equipment by IP address
Assigns a piece of equipment based on its IP address
Associated element Assign: equipment by IP address 192.168.1.10
Assign: equipment by FQDN
Assigns a piece of equipment based on its FQDN
Associated element Assign: equipment by FQDN server1.example.com
Assign: equipment by MAC
Assigns a piece of equipment based on its MAC address
Associated element Assign: equipment by MAC 00:37:6C:E2:EB:62
Recalculate
Automatically recalculates a value
Priority Recalculate
Delete
Deletes the value of the field
Time to resolve Delete
Do not calculate
Prevents the automatic calculation of a field
Time to own Do not calculate
Send
Sends a notification
Automatic reminders of SLAs Send Yes
Send a validation request
Sends a validation request
Send a validation request - User Send John Doe
Copy from user
Copies the value from the user
Location Copy from user
Copy default from user
Copies the default value from the user
Group Copy default from user
Copy first group from user
Copies the user's first group
Group Copy first group from user
Copy from item
Copies the value from an associated item
Technician group Copy from item
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.
Last updated