# Mastering Rules

As discussed in our Triggers & Filter's guide, Smart Order Notifications uses rules to determine when to send an notification (or include it in a batch) and which line items to include in the notification. These rules are configured using the Triggers & Filters form in the notification edit screen.

![](https://3989307847-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma8TOmjoIGuVeWH0eGe%2F-Mdbk6tDup_2wu094uSl%2F-Mdbl1iZlEamty4HWHF1%2FScreenshot%20from%202021-07-02%2016-08-09.png?alt=media\&token=1b6f90df-2550-4b79-bdc3-7a6794a815c2)

Both sections of the form function and behave in the same manner. First they ask for a **field**, then an **operator** and finally a **value**. The three in combination make up a rule.

`Product SKU is equal to ABC123`

In the rule above breaks down like so:

**Field**: Product SKU\
**Operator**: is equal to\
**Value**: ABC123

Our rule matcher uses these elements to determine if the order matches your rule or not. In the case of our example we would look at each line item on the order and check if any of their product SKUs are equal to "ABC123". If it finds a match, the order will trigger a notification or will be included in the batch.

### Types of Rules

| Rule Type    |   | Description                                                                           |
| ------------ | - | ------------------------------------------------------------------------------------- |
| **Triggers** |   | Triggers determine which orders should send a notification or be included in a match. |
| **Filters**  |   | Filters determine which line items should be sent in the notification.                |

Think of this process as a funnel. At the top of the funnel triggers check which orders qualify to send a notification. At the bottom of the funnel filters weed out line items that are not relervant. This gives you complete control over when the notification sends and what it contains.

### All or Any Conditions

At the top of each rule form you have control over whether Smart Order Notifications should match **all** conditions of the rule or **any** condition of the rule. See example below:

![](https://3989307847-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma8TOmjoIGuVeWH0eGe%2F-Mdbk6tDup_2wu094uSl%2F-MdboqObuAvZ2KHZYx_m%2FScreenshot%20from%202021-07-02%2016-25-15.png?alt=media\&token=90d01287-e08c-4d7c-a223-26fff30546ec)

How do these condition options work?

| Condition Options  |   | Description                                                                                                                                                     |
| ------------------ | - | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **all conditions** |   | This ensures that all the conditions you create must be true in order for the notification to be sent or the line item to be included.                          |
| **any condition**  |   | The any conditions option means that if one or more of the conditions you create are true then the notification will be sent or the line item will be included. |

Using the **all conditions** option is powerful when you want to match very specific order states, for example: an order with a product with a certain SKU, with a destination country of the USA and a customer tag of VIP.&#x20;

On the other hand, the **any condition** will allow you to create much broader rules. For example: any order with one of 15 different product types or any order with a destination postal code that contains "BA1".

{% hint style="warning" %}
**Mixing Any and All**\
It's not possible to mix **any** and **all** rules. Allowing you to combine these rule types is a feature we have on our roadmap. This will allow you to create rules that match one of many postal codes and a destination country of United Kingdom (for example). However, currently you have to choose between **any** and **all**.
{% endhint %}

If you need assistance building your rules, please do not hesitate to [reach out](https://smart-notifications.gitbook.io/docs/help-and-support/contacting-support).


---

# 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://smart-notifications.gitbook.io/docs/getting-started/mastering-rules.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.
