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

# Getting Started with Rules

> Understand the rules engine in Veles: how to build pricing guardrails, validation logic, and approval triggers that govern your quoting process.

Rules are the enforcement layer of your deal desk. They automate pricing adjustments, prevent invalid configurations, enforce discount guardrails, and trigger approval workflows -- all in real time as reps build quotes.

Every rule follows the same pattern: **if** a condition is met on a quote, **then** take an action. The condition can evaluate anything from the total deal discount to a specific product's quantity. The action can display a warning, block the quote from saving, adjust pricing automatically, or route the deal for approval.

Rules are configured by admins in the **Admin Console > Price Books > Rules** and apply automatically during quoting. Reps don't need to know the rules exist -- they see the results as alerts, price adjustments, or approval requirements on their quotes.

***

## Rule kinds

Every rule has a **kind** that determines where it evaluates and what it can do. There are four kinds:

| Kind                                                                           | Where it evaluates        | What it does                                                              | Use case                                                                    |
| ------------------------------------------------------------------------------ | ------------------------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| [**Quote Validation**](/get-started/rules-and-approval/quote-validation-rules) | The entire Pricing Option | Validates deal-level conditions and can warn, block, or require approval. | "Discount cannot exceed 25% on any option."                                 |
| [**Pricing Rule**](/get-started/rules-and-approval/pricing-rules)              | Line items or the option  | Automatically adjusts pricing based on conditions.                        | "Apply 5% bundle discount when Platform and Analytics are both present."    |
| [**Row Validation**](/get-started/rules-and-approval/untitled-page)            | Individual line items     | Validates line-level conditions and can warn, block, or require approval. | "Discount on this SKU cannot exceed 10%."                                   |
| [**Formula Rule**](/get-started/rules-and-approval/formula-rules)              | Custom scope              | Evaluates complex logic using the formula engine.                         | "If TCV exceeds \$500k and term is less than 2 years, require VP approval." |

Choose the kind based on what you're trying to enforce. Quote Validation and Row Validation are the most common starting points. Pricing Rules are for automated adjustments. Formula Rules are for complex multi-variable logic.

***

## Creating a rule

Navigate to **Admin Console > Price Books > Rules** and click **Create New Rule**.

### Rule details

Every rule starts with four fields:

| Field           | Description                                                                                    |
| --------------- | ---------------------------------------------------------------------------------------------- |
| **Name**        | A clear, descriptive name (e.g., "Enterprise Discount Limit", "Require Shipping on Hardware"). |
| **Description** | An explanation of what the rule does and why, for other admins.                                |
| **Status**      | **Active** or **Inactive**. Only active rules are evaluated during quoting.                    |
| **Kind**        | The rule type: Quote Validation, Pricing Rule, Row Validation, or Formula Rule.                |

Click **Save** to create the rule, then build the logic.

***

## Building rule sets

A rule's logic is defined through one or more **Rule Sets**. Each Rule Set is an "if/then" block consisting of a **Scope**, one or more **conditions** (Facts + Operators), and an **Action**.

Click **New Rule Set** to start building.

### Scope

The scope determines what the rule is evaluating: the whole **Option** (deal-level) or a specific **Row** (line-item-level).

### Facts

Facts are the data points available for building conditions. The available facts depend on the scope:

<Tabs>
  <Tab title="Option scope">
    | Fact                     | What it evaluates                                  |
    | ------------------------ | -------------------------------------------------- |
    | **Billing Frequency**    | The billing cadence selected on the option.        |
    | **Currency Code**        | The currency of the option.                        |
    | **Discount %**           | The overall discount percentage on the option.     |
    | **Recurring Discount %** | The discount percentage on recurring items only.   |
    | **List Price**           | The total list price before adjustments.           |
    | **Final Rate**           | The final rate after all adjustments.              |
    | **Product Count**        | The number of distinct products on the option.     |
    | **Promotion Count**      | The number of promotions applied.                  |
    | **Year**                 | The year of the commitment (for multi-year deals). |
    | **Total**                | The total deal value.                              |
    | **Recurring Total**      | The total recurring value.                         |
    | **One-time Total**       | The total one-time value.                          |
  </Tab>

  <Tab title="Row scope">
    | Fact                | What it evaluates                                                                               |
    | ------------------- | ----------------------------------------------------------------------------------------------- |
    | **Product SKU**     | The SKU of the line item.                                                                       |
    | **Product ID**      | The internal product identifier.                                                                |
    | **Product Name**    | The display name of the product.                                                                |
    | **Row Discount**    | The discount percentage on this specific line.                                                  |
    | **Category**        | The [Product Category](/get-started/pricing-and-packaging/product-categories) of the line item. |
    | **Row Total**       | The total value of this line.                                                                   |
    | **Final Rate**      | The final per-unit rate on this line.                                                           |
    | **Total**           | The line's total value.                                                                         |
    | **Recurring Total** | The recurring portion of this line.                                                             |
    | **One-time Total**  | The one-time portion of this line.                                                              |
    | **Unit of Measure** | The [UOM](/get-started/pricing-and-packaging/units-of-measure) assigned to this product.        |
  </Tab>
</Tabs>

### Operators

Compare facts against values using standard operators:

| Operator                        | Usage                                                                              |
| ------------------------------- | ---------------------------------------------------------------------------------- |
| **Equals** / **Not Equals**     | Exact match or exclusion.                                                          |
| **Is Greater Than or Equal To** | Numeric threshold (inclusive).                                                     |
| **Is Less Than**                | Numeric upper bound.                                                               |
| **Is In** / **Is None Of**      | Match against a list of values (e.g., "SKU is in \[PLATFORM-001, ANALYTICS-001]"). |

### Multiple conditions

You can add multiple conditions to a single Rule Set (all must be true for the action to fire), or create **sub-conditions** that target the same row for more granular control.

**Example:** A rule that triggers when the discount is greater than 20% **and** the billing frequency is monthly **and** the product category is "Enterprise."

***

## Actions

When a Rule Set's conditions are met, the system takes an action. Actions have two components: a **message** and a **severity**.

### Message

A custom text message displayed to the rep on the quote. Write clear, actionable messages that explain what's wrong and what needs to happen.

**Good:** "Discount exceeds 20% on Enterprise products. Requires VP approval." **Bad:** "Rule violated."

### Severity

| Severity  | Behavior                                                                                                                                                                      |
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Warn**  | Flags a warning on the quote. The rep can see the alert but can still save and continue editing. The warning must be resolved (typically through approval) before publishing. |
| **Error** | Blocks the rep from saving or moving forward until the condition is resolved. Use for hard constraints that should never be violated (e.g., selling below cost).              |

<Tip>
  Start with **Warn** severity for most rules. This lets reps continue building the deal while surfacing the issue. Reserve **Error** severity for non-negotiable constraints where the deal configuration is fundamentally invalid.
</Tip>

***

## Approval triggers

Rules can require formal approval before the quote can be published.

1. Toggle **Requires Approver** on the Rule Set's action.
2. Select the **Approval Tier** from your predefined tiers (configured in [Approvals](/get-started/calculator/approvals)).

When the rule fires, the Publish button on the quote changes to **Request Approval**, and the deal is routed to the appropriate tier. The quote cannot be published until the approver signs off.

**Example setup:**

| Rule               | Condition              | Severity | Approval tier         |
| ------------------ | ---------------------- | -------- | --------------------- |
| Moderate discount  | Discount 10-20%        | Warn     | Tier 1: Sales Manager |
| Large discount     | Discount > 20%         | Warn     | Tier 2: VP of Sales   |
| Below-cost pricing | Net price \< cost      | Error    | (blocks entirely)     |
| Non-standard terms | Payment terms > Net-30 | Warn     | Tier 3: Finance       |

***

## Common rule patterns

### Maximum discount limit

* **Kind:** Quote Validation
* **Scope:** Option
* **Fact:** Discount %
* **Operator:** Is Greater Than or Equal To
* **Value:** 25
* **Action:** Warn, "Deal discount exceeds 25%. Requires Deal Desk approval."
* **Approval:** Tier 2 (Deal Desk)

### Product-specific discount cap

* **Kind:** Row Validation
* **Scope:** Row
* **Condition 1:** Product SKU equals `PLATFORM-001`
* **Condition 2:** Row Discount is Greater Than or Equal To 15
* **Action:** Warn, "Platform discount exceeds 15%. Requires manager approval."
* **Approval:** Tier 1 (Sales Manager)

### Required product bundling

* **Kind:** Quote Validation
* **Scope:** Option
* **Condition 1:** Category "Hardware" product count > 0
* **Condition 2:** Category "Shipping" product count equals 0
* **Action:** Error, "Hardware products require a Shipping line item."

### Multi-product bundle discount

* **Kind:** Pricing Rule
* **Scope:** Option
* **Condition:** Product Count is Greater Than or Equal To 3
* **Action:** Apply 5% automatic discount to all recurring line items.

***

## How rules connect to the rest of the platform

Rules don't operate in isolation. They reference and interact with multiple parts of the Veles configuration:

[**Product Categories**](/get-started/pricing-and-packaging/product-categories) can be used as conditions. Rules can fire based on which product families are present on a quote.

[**Data Sheets**](/get-started/pricing-and-packaging/data-sheets) can provide the reference values for rule conditions. A discount threshold data sheet keyed by customer segment allows different limits for Enterprise vs. SMB deals.

[**Custom Fields**](/get-started/pricing-and-packaging/product) on products and quote lines can be evaluated in rule conditions, enabling rules based on region, vertical, or other metadata.

[**Approval Tiers**](/get-started/calculator/approvals) are the escalation targets when rules require sign-off. The tier system and the org hierarchy determine who reviews the deal.

[**Quote Lines**](/get-started/calculator/quote-line) display rule alerts directly on the affected line item, giving reps immediate visibility into which lines triggered which rules.

***

## The workflow at a glance

<Steps>
  <Step title="Define the rule">
    Name it, describe it, set the kind, and activate it.
  </Step>

  <Step title="Build the rule set">
    Choose the scope, select facts, set operators, and define the condition.
  </Step>

  <Step title="Configure the action">
    Write the message, set the severity (Warn or Error), and optionally enable approval routing with a specific tier.
  </Step>

  <Step title="Test">
    Build a test quote that triggers the rule. Verify the alert appears, the message is clear, and the approval routes correctly.
  </Step>
</Steps>

***

## What's next

<CardGroup cols={2}>
  <Card title="Quote Validation Rules" icon="file-circle-check" href="/get-started/rules-and-approval/quote-validation-rules">
    Rules that evaluate the entire Pricing Option.
  </Card>

  <Card title="Pricing Rules" icon="tag" href="/get-started/rules-and-approval/pricing-rules">
    Rules that automatically adjust pricing based on conditions.
  </Card>

  <Card title="Row Validation Rules" icon="table-rows" href="/get-started/rules-and-approval/untitled-page">
    Rules that evaluate individual line items.
  </Card>

  <Card title="Formula Rules" icon="function" href="/get-started/rules-and-approval/formula-rules">
    Complex multi-variable logic using the formula engine.
  </Card>

  <Card title="Approvals" icon="check-double" href="/get-started/calculator/approvals">
    Configure the approval tiers that rules route to.
  </Card>

  <Card title="Translating SFDC Rules" icon="arrow-right-arrow-left" href="/get-started/rules-and-approval/translating-sfdc-rules-to-veles">
    Migrating from Salesforce CPQ? Map your existing rules to Veles.
  </Card>
</CardGroup>
