# Creating a dispatch rule

Dispatch rules determine which drivers are getting assigned to an order once they are ready for delivery. Multiple conditions can be set in one rule.\
\
One example is to assign orders to a driver based on the delivery location. Let's do just that!

## Step 1 - Navigate to dispatch rules setup

The dispatch rules setup page is enabled in both **Sales** and **Inventory**. Once you are on either pages, click on **"Configuration"**.

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

Click **"Dispatch rules".**

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

## Step 2 - Creating a rule

Click **"Create"**. We are going to create a rule for assigning orders by matching delivery destination to the driver's city.

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

Type in the name **"Talisay Orders"** and in conditions click **"Add a line".**

<figure><img src="/files/9AIyAkC3w3oyIbJfinCG" alt=""><figcaption></figcaption></figure>

Check "**Order city from Talisay"** and click **"Select"**.

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

## Step 3 - Selecting a driver

Now, we are going to select the preferred drivers. For now, let's just select one.

On the **"Preferred Drivers"** click **"Add a line"**

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

From here, you will see a list of users. Let's click on **"Filters".**

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

At the bottom part, selec&#x74;**"Add Custom Filter"** and **"Has Vehicle" : "Is Yes"**. And click **"Apply"**.

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

Select one.

<figure><img src="/files/62HYhgHBu2x5h3xgL0q5" alt=""><figcaption></figcaption></figure>

Then finally, click **"Create"** or **"Save manually"** button.

<figure><img src="/files/4hvQQx1AeIHniNvbayy8" alt=""><figcaption></figcaption></figure>

Now we have a dispatch rule for Talisay Orders to be matched with Delfin Nav for delivery.

## Further improvements

At present there are two conditions for this proof-of-concept — the delivery city, and the packaging size of the order. More conditions to be added soon!

The selection of preferred drivers is easy if there is only one matching driver. Currently, when there are multiple drivers preferred, a random selection is done. In the future, other features will be considered for the selection.


---

# 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.next-way.org/product-guides/creating-a-dispatch-rule.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.
