# Routing rules

Write reusable conditions that decide which leads a router acts on, with AND/OR groups, built-in presets and worked examples.

Source: https://support.rework.com/article/lead-routing-rules

> **In plain words:** A **routing rule** is a saved set of conditions, such as "country is Vietnam and budget is over 10,000". A router asks the rule a yes-or-no question about each lead: does it match? You write a rule once and use it in as many routers as you like. Read this page when you want a router to treat some leads differently from others.

**Where to find it:** In Lead, open your service in the left sidebar, click **SLA & Routing**, then **Routing rules** (under **Configuration**). You can also use **Settings**, then **Routing & Distribution**, then **Routing Rules**. **Who can use it:** People who manage the service.

## Where rules are used

Three router blocks ask for a rule:

- **Entry Rule**: only matching leads continue.
  
- **Routing Rule**: matching leads go one way, the rest go another.
  
- **Service Level Agreement** (when it evaluates by rule): a match means a breach.
  

See [Router blocks reference](https://support.rework.com/article/lead-router-blocks).

## Create a rule

1. In **SLA & Routing**, click **Routing rules**.
   
2. Click **New rule**. A dialog named **New rule** opens.
   
3. Type a **Rule name**, for example "Vietnam, big budget".
   
4. Under **Conditions**, build the conditions (next section).
   
5. Click **Create rule**.
   

You should see the rule in the list. You can also create a rule while building a router. In a block's **Rule** picker, click **New rule** at the bottom.

## Build conditions

A rule is made of **conditions**. Each condition is a sentence with three parts: a **field**, an **operator** and a **value**. Example: **Budget** (field) **greater than** (operator) **10000** (value).

1. The first row starts with **Where**. Click **Select field** and choose a field.
   
2. Choose an operator. The list only shows operators that make sense for that field.
   
3. Enter or pick a value. Some operators need no value.
   
4. Click **Add condition** for another row.
   

### AND and OR

With more than one row, each new row starts with **AND** or **OR**. Click the word to switch the whole group between them.

- **AND**: every condition must be true.
  
- **OR**: at least one must be true.
  

For mixed logic, click **Add inner group**. A group is a box of its own with its own AND or OR. Example: "country is Vietnam **AND** (budget over 10000 **OR** company is on the VIP list)". The trash icon on a group removes it. There is a limit on how deeply groups can nest.

![The New rule dialog with the rule name](https://storage.googleapis.com/reworkv3-public/success/261015/vFRN7G2EgSMfRKhWqXT6eLwF5Anw6QvUYBdoNL9e57y0dDtBXFqZ30sgtEPs5mA1/img.YQvXY4rbdzjObSkkuyq3y4YdD6lNJ1PIGZKLcr6sxhlCnFCgOPAh1KSL9b2H2Ae9.png)

### Fields you can use

The field list is split into groups.

| 
Group

 | 

What is in it

 |
| --- | --- |
| 

**System fields**

 | 

Built-in lead facts: name, email, phone, job title, company, owner, stage, status, score, lead source, labels, campaign, UTM values, created time, whether the visitor is returning, and more.

 |
| 

**Custom fields**

 | 

The fields your team added to this service. See [Custom fields](https://support.rework.com/article/lead-custom-fields).

 |
| 

**Segments**

 | 

One pick-list per segmentation you created.

 |
| 

**Profile**

 | 

Facts about the person's **profile** (the one record Lead keeps for a person across all their leads). See below.

 |

The **Profile** group has seven fields:

| 
Profile field

 | 

What it tells you

 |
| --- | --- |
| 

**Profile already exists**

 | 

Yes when this person already has an earlier lead, so this is not their first.

 |
| 

**Profile has been converted**

 | 

Yes when any lead of this person has been converted to Sales.

 |
| 

**Profile not in progress**

 | 

Yes when none of this person's leads is in an **In progress** stage group right now.

 |
| 

**Profile current lead owner**

 | 

The owner of this person's most recent lead.

 |
| 

**Profile deal owner (salesman)**

 | 

The owner of this person's most recent deal.

 |
| 

**Previous lead source**

 | 

The source of this person's previous lead.

 |
| 

**Previous lead service**

 | 

The service of this person's previous lead.

 |

Profile fields do not appear in the **When these fields change** list of a **Trigger**. Use them in a rule after a trigger such as **Record is created**.

### Operators in plain words

The operators on offer depend on the field type.

| 
Operator

 | 

Reads as

 | 

Used with

 |
| --- | --- | --- |
| 

**equals** / **does not equal**

 | 

is exactly / is anything but

 | 

text, number, date, pick-list, person

 |
| 

**contains** / **does not contain**

 | 

includes this text / does not

 | 

text, phone

 |
| 

**starts with** / **ends with**

 | 

begins / finishes with this text

 | 

text, phone

 |
| 

**greater than**, **greater or equal**, **less than**, **less or equal**

 | 

compares a number

 | 

number

 |
| 

**before** / **after**

 | 

earlier / later than a date

 | 

date

 |
| 

**more than … ago**

 | 

older than, for example more than 2 days ago

 | 

date

 |
| 

**within the last …**

 | 

newer than, for example within the last 1 hour

 | 

date

 |
| 

**in date range** / **outside date range**

 | 

between two dates / not

 | 

date

 |
| 

**is any of** / **is none of**

 | 

matches one of a list / none of it

 | 

pick-list, text, person, labels

 |
| 

**is in team** / **is not in team**

 | 

person belongs to a distribution team

 | 

person

 |
| 

**is empty** / **is not empty**

 | 

nothing filled in / something filled in

 | 

most fields

 |

A yes-or-no field (a checkbox) offers **equals** with the value **Yes** or **No**.

## Preset rules

Lead comes with built-in rules marked **Preset**. They cannot be edited or deleted.

| 
Preset

 | 

Matches

 |
| --- | --- |
| 

**Catch-all**

 | 

Every lead. Use it as the default branch or to let everything through an **Entry Rule**.

 |
| 

**Lead is assigned**

 | 

A lead that already has an owner.

 |
| 

**Owner has no note**

 | 

The owner has not logged a note on this lead.

 |
| 

**Owner has no email**

 | 

The owner has not logged an email on this lead.

 |
| 

**Owner has no call**

 | 

The owner has not logged a call on this lead.

 |
| 

**Owner has no meeting**

 | 

The owner has not logged a meeting on this lead.

 |

The four **Owner has no ...** presets are made for the **Service Level Agreement** block. Set a duration, and if the owner still has not acted when it ends, the actions run. See [Router blocks reference](https://support.rework.com/article/lead-router-blocks).

## Worked examples

### Example 1: Vietnam leads with a big budget

Goal: send high-value Vietnam leads to your senior team.

You need two custom fields on the service: **Country** (a pick-list) and **Budget** (a number). See [Custom fields](https://support.rework.com/article/lead-custom-fields).

1. Click **New rule** and name it "Vietnam, big budget".
   
2. First row: **Country** **equals** **Vietnam**.
   
3. Click **Add condition**. The second row starts with **AND**. Choose **Budget** **greater than** **10000**.
   
4. Click **Create rule**.
   

How it behaves:

| 
Lead

 | 

Country

 | 

Budget

 | 

Matches?

 |
| --- | --- | --- | --- |
| 

Linh

 | 

Vietnam

 | 

15000

 | 

Yes

 |
| 

Duc

 | 

Vietnam

 | 

8000

 | 

No, budget too low

 |
| 

Hoa

 | 

Singapore

 | 

20000

 | 

No, wrong country

 |

Use the rule in a **Routing Rule** block. Matched leads go to the Senior team. Everyone else goes to the General team.

### Example 2: Leads from returning customers

Goal: give a lead from an existing customer to the rep who already looks after them.

1. Click **New rule** and name it "Returning customer".
   
2. First row: **Profile has been converted** **equals** **Yes**.
   
3. Click **Create rule**.
   

Use it in a **Routing Rule**. On the **Matched** branch, add **Assign & Update Ownership** with **Specific user** and **Assign to current record owner** on. See [Router blocks reference](https://support.rework.com/article/lead-router-blocks). The **Otherwise** branch goes to your normal team.

## Edit, duplicate and delete

Each rule row has three icons on the right. Click a rule row to open its details: **Conditions** (as a tree or a one-line **Expression**), **Used in**, **Activity** and **Details**.

| 
Action

 | 

What it does

 |
| --- | --- |
| 

**Edit**

 | 

Opens **Edit rule**. Change the name or conditions, then click **Save changes**.

 |
| 

**Duplicate**

 | 

Makes a copy named "your rule (copy)". Handy for a variation.

 |
| 

**Delete**

 | 

Asks **Delete rule?** first. This cannot be undone.

 |

If the rule is used in a router, Lead lists those routers and warns: "Deleting it leaves those nodes without a rule". The blocks then show **Rule was deleted** and must be fixed before the router can be published again.

Click a rule in the list **(1)** to see its conditions tree **(2)** and the **Used in** section **(3)**. **Used in** lists each router that uses the rule and whether that router is live and up to date.

![Routing rules list with the Wholesale B2B enquiry rule open, highlighting the rule card, the Match ANY conditions tree and the Used in 1 flow section showing Inbound lead routing as Live and up to date](https://storage.googleapis.com/reworkv3-public/success/260928/R04hFMcDjLL5Q2Vn01Vt4IlY7AZsCSTL9lWESS6tct7iz4IFgV6jEb2naDu0tva7/img.40iUSOVnGIUl6ifNz6kMAz4XtsnAz9wjJdVqdNA4nzUP1UGKTmkA8xZmNOu8ERTB.png)

> **Important:** Editing a rule does not change a router that is already published. Each router keeps the conditions it was published with. After you edit, republish the routers listed under **Used in**. The rule shows **N flows to republish** until you do. See [Publishing, versions and republishing](https://support.rework.com/article/lead-publishing-and-versions).

## Validation messages

If you click **Create rule** or **Save changes** with a problem, a red list appears under the conditions.

| 
Message

 | 

Fix

 |
| --- | --- |
| 

Rule name is required

 | 

Type a name.

 |
| 

Add at least one condition

 | 

Add a row with a field.

 |
| 

Condition N: select a field

 | 

Choose a field in row N.

 |
| 

Condition N: select an operator

 | 

Choose an operator in row N.

 |
| 

Condition N: enter or select a value

 | 

Fill in the value in row N.

 |
| 

Condition N: select at least one value

 | 

For **is any of** or **is none of**, pick at least one.

 |
| 

Condition N: enter a valid duration

 | 

For **more than … ago** or **within the last …**, enter a number and a unit.

 |
| 

Condition N: enter both range dates

 | 

For date ranges, fill both dates.

 |

## Troubleshooting

| 
Problem

 | 

Why it happens

 | 

What to do

 |
| --- | --- | --- |
| 

A pick-list field shows **No options to select**

 | 

The field matches by a value chosen from a list, and the list is empty.

 | 

Add the records first (for example sources or ad campaigns), then reopen the rule.

 |
| 

A rule matches every lead

 | 

It has no conditions, or it is the **Catch-all** preset.

 | 

Add conditions.

 |
| 

An edit did not change who gets leads

 | 

The router still uses the version it was published with.

 | 

Republish the routers under **Used in**.

 |
| 

A rule I want to delete is in use

 | 

Routers still point at it.

 | 

Open **Used in**, change those blocks, then delete.

 |

More fixes: [Fix it by symptom](https://support.rework.com/article/lead-fix-by-symptom).
