> ## Documentation Index
> Fetch the complete documentation index at: https://nectarclimate.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Rules

> Configure routing and GL coding rules that automatically process incoming bills.

<Tip>Need help in this area? See [Bill Pay FAQ](/docs/platform/bill-pay/faq).</Tip>

Rules are the logic engine behind Bill Pay. Each rule defines **conditions** (when should this rule fire?) and **actions** (what should happen?).

Evaluation has two phases:

1. **GL coding** — first matching active GL rule wins (creation order). Later GL rules are skipped.
2. **Routing** — every matching active routing rule fires. Destinations are deduplicated so each destination receives the bill only once.

## Rule types

Bill Pay has two types of rules, evaluated in sequence:

| Type                | Purpose                      | Example                                                       |
| ------------------- | ---------------------------- | ------------------------------------------------------------- |
| **Routing rules**   | Determine where a bill goes  | "Forward all electricity bills over \$5,000 to the CFO inbox" |
| **GL coding rules** | Assign a general ledger code | "Tag all water bills at the Chicago site with GL code 6200"   |

GL coding rules are evaluated first, then routing rules. This means a bill can receive a GL code and be forwarded in the same evaluation pass.

## Creating a rule

<Steps>
  <Step title="Choose a rule type">
    Go to [**Bill Pay > Rules**](https://dash.nectarclimate.com/bill-pay/rules) and click **New
    rule**. Select either **Add GL coding rule** or **Add routing rule**.
  </Step>

  <Step title="Name your rule">
    Give the rule a descriptive name (e.g., "Northeast electricity to AP team") and optionally add a description explaining its purpose.
  </Step>

  <Step title="Build conditions">
    Drag condition blocks from the palette onto the canvas. Each condition tests a specific field against a value — for example, "Commodity equals Electricity" or "Total charges is greater than 1000."
  </Step>

  <Step title="Add logic groups">
    Drag **AND group** or **OR group** from the palette. Switch a group to **NOT** on the canvas if you need to invert it — NOT is not a separate palette item.
  </Step>

  <Step title="Configure actions">
    For **routing** rules, drag actions onto the canvas: **Forward to email**, **Route to AP
    integration**, **Request funds**, or **Notify user**. For **GL coding** rules, fill in the
    auto-added **Assign GL code** field — you do not drag a separate GL action block.
  </Step>

  <Step title="Preview and save">
    The builder **PREVIEW** panel updates as you edit (use the refresh icon if needed). It tests
    conditions against recent bills; it does not simulate which actions would fire. When ready,
    click **Create & enable** (new rules) or **Save & enable** (edits) to activate immediately, or
    **Save** to keep the rule inactive.
  </Step>
</Steps>

## Condition fields

You can build conditions using any of these bill, site, and account attributes:

| Category               | Field            | Description                                                                                              |
| ---------------------- | ---------------- | -------------------------------------------------------------------------------------------------------- |
| **Bill**               | Commodity        | Any tracked commodity (for example Electricity, Natural Gas, Water, Waste, Fuel, District Energy, Solar) |
| **Bill**               | Total charges    | The total dollar amount on the bill                                                                      |
| **Bill**               | Flagged status   | Whether the bill has been manually flagged                                                               |
| **Bill**               | Utility provider | The specific datasource or provider                                                                      |
| **Bill**               | Currency         | The billing currency (USD, CAD, EUR, etc.)                                                               |
| **Site**               | Site             | A specific site or set of sites                                                                          |
| **Site**               | Site tag         | Tags assigned to the bill's site                                                                         |
| **Site**               | Site location    | The geographic location of the site                                                                      |
| **Account**            | Account          | A specific utility account                                                                               |
| **Utility Connection** | Connection       | The connection that collected the bill                                                                   |

## Operators

Each condition uses an operator to compare the field against a value (operators available depend on the field):

| Operator                      | Meaning                         |
| ----------------------------- | ------------------------------- |
| equals / does not equal       | Exact match                     |
| is one of / is not one of     | Match against a list            |
| contains / does not contain   | Partial text match              |
| is greater than / is at least | Numeric comparison              |
| is less than / is at most     | Numeric comparison              |
| is between                    | Numeric range                   |
| is empty / is not empty       | Checks if the field has a value |

## Action types

### Routing rule actions

| Action                      | Effect                                                                   |
| --------------------------- | ------------------------------------------------------------------------ |
| **Forward to email**        | Sends the bill to an email [destination](/docs/platform/glossary#destination) |
| **Route to AP integration** | Pushes the bill to a connected ERP system                                |
| **Request funds**           | Enters the centralized payment path where Nectar handles payment         |
| **Notify user**             | Sends a notification email to specified team members                     |

### GL coding rule actions

| Action             | Effect                                           |
| ------------------ | ------------------------------------------------ |
| **Assign GL code** | Tags the bill with a general ledger account code |

## Evaluation order

Active rules are evaluated in creation order. There is no drag-to-reorder control on the rules list.

* **GL coding:** the first matching rule wins.
* **Routing:** all matching rules fire, with destination deduplication so each destination only receives the bill once.

## Dry-run preview

While you edit a rule, the **PREVIEW** panel auto-tests conditions against your recent bills. It shows how many bills would match, plus sample matches and non-matches. It does not preview which actions would fire.

## Version history

Every time you save changes to a rule, a new version is created. You can view the full edit history by clicking **Edit history** when viewing a rule. This audit trail shows who changed what and when, making it easy to understand why routing behavior changed.

## Catch-all destination

If a bill doesn't match any routing rule, it enters a **Pending routing** state and waits for manual assignment. To avoid this, you can designate a **catch-all destination** — a fallback that receives any unmatched bills. Set this from the rules page (**Set catch-all** / **Change catch-all**), or star a destination on [Destinations](/docs/platform/bill-pay/destinations).

## Related pages

* [Destinations](/docs/platform/bill-pay/destinations) — set up the email addresses and ERP systems your rules route to
* [Routing history](/docs/platform/bill-pay/decisions) — see how rules evaluated against actual bills
* [Glossary — Routing rule](/docs/platform/glossary#routing-rule) — definition
