Skip to main content

How Rules are Connected to the Quote and How to Build a Rule

In this guide, we will explore how rules interact with the Quote structure, and provide instructions on how to start building your rules.

Overview of the Quote

The quote consists of multiple sections that hold various line items, totals, and other data. Here’s an outline of what a quote contains:

Sections

Each section represents a distinct part of the quote, such as products, add-ons, and fees. sections_in_quote.png

Each section has:

  • Name: Name is a section identifier quote_section_names.png
  • Columns: Specific attributes related to the quote item (e.g., price, quantity, etc.). Each section contains a set of columns (e.g., price, quantity, discount, etc.) and has its own set of totals. quote_section_columns.png
  • Line items Each section contains a set of products from your catalog or newly created products quote_section_line_items.png
  • Footers/Section Totals: These are totals specific to the section and can either be default or custom. quote_section_footer.png
  • Section settings: These are define a way how to display line items in the section, should this section be optional or not, and should the recipient be able to edit section quantity or not. quote_section_settings.png

Grand Total or Quote total

This is the total of all sections combined, which may include calculated values such as total price, subtotal, total discounts, etc. grand_total_or_quote_total.png

Data Fields or Quote variables

These are fields that allow you to pass data between steps in a workflow or temporarily store values for calculations. quote_data_fields.png

Quote settings

There are sections that define the currency and recipient options for this quote.
quote_settings.png

Example Sections

For example, we may have the following sections:

  • Products Section: Includes columns like price, quantity, discount, total.
  • Add-ons Section: Contains columns like price, quantity, and custom columns.
  • Fee Section: Contains specific fees, taxes, or additional charges.

You can also create custom fields to add to these sections.

Rules Structure

WHEN Clause

In the WHEN part of the rule, we filter data based on certain conditions. You can filter by:

  • Sections (e.g., filtering sections like "products").
  • Line items within a section (e.g., filtering based on quantity, price, etc.).
  • Data fields (e.g., filtering based on custom fields you defined). WHEN_clause_filter_by.png

THEN Clause

In the THEN part of the rule, actions are performed on the filtered data. For example:

  • You can update the section totals or line items that meet the filtering criteria.
  • You can modify values, such as setting the price to 100 or updating the quantity for certain line items. THEN_clause_actions.png

Please remember that you can perform actions on the items that meet the filters specified in the WHEN clause—in other words, on the aliases created in the WHEN clause. aliases_in_rules.png

However, you can also perform actions on objects that do not require a filter. aliases_not_needed.png

How to Start Building a Rule

Step 1: Define the WHEN Condition

Start by defining your WHEN condition. For instance, if you want to filter sections that contain the name "Products," you would set up the filter to match sections with this name.

You can also filter line items within the "Products" section based on conditions such as quantity greater than 1. update_line_items_whre_qty_gt_zero.png

Step 2: Define the THEN Action

Once you have filtered the appropriate data, define the actions in the THEN part of the rule. For example:

  • If a line item’s quantity is greater than 1, update the price to 100.
  • If a section has a custom total, set it accordingly.

Example Rule:

In this example, a rule could be set up to:

  • Filter the "Products" section.
  • Filter line items where the quantity is greater than 1.
  • Update the price to 100 for those line items.

Example Walkthrough

Here’s how you might build a rule step-by-step:

  1. Filter Section: Select the "Products" section.
  2. Filter Line Items: Choose to filter line items where the quantity is greater than 1.
  3. Define Action: Set the price to 100 for the filtered line items.

Testing the Rule

Let’s say you add products with varying quantities:

  • Product 1: Quantity 1 (unchanged).
  • Product 2: Quantity 2 (updated to price 100).
  • Product 3: Quantity 2 (updated to price 100).

In this case, only Product 2 and Product 3 will have their price updated, since their quantity is greater than 1.

Conclusion

This document provides a high-level overview of how to use rules within the quote structure. By filtering and performing actions on sections, line items, and data fields, you can automate and customize your quotes as needed.