# Автоназначение заявок
This article explains how to automatically distribute requests to employees and groups based on specified conditions. These settings can be made in the **Settings** - **Automatic Assignment of Requests** section.

Here you can create different rules for assigning incoming requests to different groups. Rules are created according to the principle 'If (condition 1), then place in group (group) and assign an employee who meets condition (condition 2).' By creating several such rules, you can set their order of operation.

Rules in the list of rules work from top to bottom. If the first rule does not identify a suitable employee for a new request, the system applies the next rule to the request, and so on until a condition in any rule is met.

When a request is created in the system, auto-assignment triggers as an event on request creation.

In addition, you can set up periodic reassignment of requests - this will allow you to periodically update the rules with information about the availability of an employee at the moment.

# Creating a rule

To create a new rule, click 'Create a new rule' in the upper right corner of the section. A rule creation window will open. Here is an example of a filled window:

1. Enter a **Name** - a brief and concise name for the rule that reflects its functionality.
2. Add a request selection condition using the button. First, select the request field, then the operator, then the value.
   **Field** - the field on the incoming request page.
   **Value** - the contents of this field.
   **Operator** - the relationship of the field to the value (equal, not equal, greater than, less than). The operator can be NULL - this indicates that the selected field should be empty.
   For example, we want to apply the rule only to requests with the highest priority. We select the **Priority** field, the **=** operator, and the **Urgent** value.
   Another example: we want to create a rule for assigning all morning requests to the morning shift group. Then the condition would look like this:
   ...
3. Click 'Add' to add the condition to the rule. To cancel an incorrect condition, click 'Cancel'. To delete an erroneously added condition, click the trash can icon to the right of it.
   :::note
   If necessary, activate the slider 'Do not process other rules'. This will prevent any further rules from being processed, leaving the request undistributed.
   :::
4. Select the group to which the request should be placed. You can create a new group and add agents to it in the [Settings - Group Management] section.
   :::note
   If necessary, activate the slider 'And do not assign anyone'. Then, after distribution to the Group, no Responsible will be assigned.
   :::
5. By default, the request will be assigned to any agent from the selected group who is currently **Online**. To assign a request that meets the specified conditions to specific agents, you need to add a condition for the employee. Attributes are configured in the [Settings - Custom Fields] section.
   Click in the row 'And assign to user who meets the conditions'.
   **Field** - the name of an additional attribute.
   **Value** - the value of the attribute.
   **Operator** - the relationship of the field to the value (equal or not equal).
6. If necessary, set up assignment by skills. This is additional filtering of eligible agents whose skills match the skills in the request fully or partially. Skills are added to the request on the [request page], and to the agent in their [profile].
7. To save the rule, click 'Save' in the lower right corner of the window. To close the window without saving, click 'Cancel'.
8. The rule will be added to the **Available Rules** list. For it to start working, move it to the **Active Rules** list by clicking on the + next to its name.

# Working with active rules

When a request arrives, the system tries to apply it to the rules one by one, starting with the topmost and stopping at the rule whose condition can be met for this request. If there are no suitable rules, the request will remain undistributed.

:::caution
Since rules are checked one by one from top to bottom, the given order of rules is important.
:::

To change the position of a rule in the list, drag it by clicking the left mouse button on the 6 dots to the left of the rule.

# Enabling auto-assignment for a user

For auto-assignment to assign new requests to a user, they must be **Online** in the system. A user can switch their status themselves in their profile:

Or an administrator can set it in **Settings - Agent Management**:

If necessary, you can also limit the number of **New + Open** requests per agent. While an agent has more or equal requests to the limit, new requests will not be assigned. This functionality is needed to control the load on support agents.

With the status **Offline**, requests will not be assigned to an agent. But existing unresolved requests may remain.

# Periodic redistribution mode of requests by the balancer

In the lower part of the **Automatic Request Assignment** page, you can set up periodic distribution of requests.

When the option is enabled, every set amount of time, the system checks **New** and **Open** requests and reassigns them according to the set auto-assignment rules if:

1. The **Responsible** in the request is in **Offline** status.
2. The request has no **Responsible**.

:::note
If a request was **Locked**, the balancer will not touch such a request, even if it meets the conditions above.
:::

Periodic redistribution of requests can work in one of two modes:

* **Across all rules** - the system redistributes requests using all rules, even if it means moving the request to another group.
* **Within the group** - the system redistributes requests only according to rules suitable for the group where the request is located.

You can also set the periodicity of the balancer in cron task format. By default, the balancer runs every 30 minutes.

:::tip
If the balancer has a queue of requests that need to find responsibles (this can happen if agents have a limit on the number of requests), then requests will be assigned in order of decreasing SLA Index.
:::

# Disabling auto-assignment

Starting from version 5.12, in cases where it is necessary for all requests to be assigned only in the order of decreasing SLA Index, you can disable auto-assignment while keeping the balancer enabled:

Then all requests, both newly created and reopened in the 'Open' status, will be assigned only by the SLA Index.