Skip to main content

Meet Context Rules

Learning Objectives

After completing this unit, you’ll be able to:

  • Define what a context rule is.
  • Describe the context rules framework.
  • Explain the different types of context rules.
  • Identify context rule components.

Before You Start

How much do you know? We assume you’ve already:

  • Created and amended quotes and orders in your workplace.
  • Used Product Designer to create products for your company’s catalog offerings.
  • Discussed key pricing strategies with the sales team at your office.

Still trying to figure it out? Complete the badges in the following learning path to help with the concepts and tasks you do in this module.

Context Rules in Industries CPQ

Rules, rules, rules. Some say they’re made to be broken. But when it comes to business rules and product pricing, it’s best to keep things under control. Here's where context rules come into play. Use them in Industries Configure, Price, Quote (CPQ) to define a set of conditions and actions that dynamically change the products and prices your customers see in the catalog.

You can also use them to control product availability in different situations.

In today’s competitive business climate, communications, media, and energy companies must optimize the user experience, increase operational efficiency, and drive sales to stay afloat. Context rules are key to success in these areas because they enable personalized experiences by offering customers the right products, promotions, and pricing. Context rules ensure that quotes and orders are valid before submission, minimizing order delays, customer confusion, and dissatisfaction.

In this module, you learn about context rules and the context rules framework.

A Business Scenario

Meet Eliza Young. She’s recently joined Infiwave as a CPQ developer. As you’ll recall from previous modules in the learning path, Infiwave is a communications service provider (CSP) that sells communications equipment and services to businesses and consumers.

Eliza Young, the CPQ developer at Infiwave.

Eliza’s work requires some technical expertise to ensure the CPQ solution runs smoothly at Infiwave. Her role involves designing and building context rules to offer products and services to customers at the right prices.

To understand how to use context rules in your business, it’s best to get a high-level understanding of the context rules framework.

Context Rules Framework

The context rules framework gives you the tools to create and implement context rules effectively. Using this framework, Eliza can control which products and promotions appear on the Qualified and Disqualified tabs in the Industries CPQ Cart, whether a penalty applies to an account, what the penalty is, and much more.

The diagram shows the key elements in the context rules framework.

Key elements of the context rule framework.

Read more about each element.

  • A trigger event occurs when a specific action happens, like when a customer adds a product to the Cart. The event causes the execution of an Industries CPQ interface, which then calls the active interface implementation.
  • A rule set is a logical grouping of one or more context rules. A context rule can’t be associated directly with a product or service. To do this, you use rule sets. To express multiple or complex conditions, group rules into a rule set. For example, to require that a customer has had an account for more than 365 days and is a New York resident, use a rule set.
  • A context rule contains the information needed to determine when a rule set fires in the Cart. Context rules contain rule conditions, which are made up of context dimensions, context scopes, and context mappings.

Later in this module, you can try creating all the elements of the context rule framework from scratch. To do this, you request a special training org that contains Industries CPQ and our sample data. Before that, let's look at context rules in more detail.

Context Rule Types

Qualification rules and penalty rules are the two types of context rules. Each type serves a distinct purpose and helps shape the customer experience. It’s important to understand the difference. Qualification rules apply to products and promotions, while penalty rules apply to promotions and contracts.

Qualification rules regulate the availability of products, promotions, price lists, and price list entries. They also control which pricing adjustments to apply, and under what circumstances. Qualification rules are critical for filtering and presenting the appropriate options to customers during their shopping experience. For example, a qualification rule can limit the availability of a specific product or promotion to long-term customers or it can show West Coast pricing to California residents.

Penalty rules determine whether a fine applies to an account and what the penalty is. These rules apply only to Move, Add, Change, or Disconnection of services (MACD) or asset-based orders. For example, if a customer decides to cancel their 12-month service subscription early, you can use a penalty rule to apply a penalty fee to their account.

Context Rule Components

The components of context rules include context dimension, context scope, and context mapping.

The components of the rule conditions: Context Dimension, Context Scope, and Context Mapping.

These components are independent and reusable. After you build them, you can establish a library of components to reduce development time.

Eliza wants to build reusable components for context rules to reduce overall development time. Given Infiwave's budget constraints, this should make the rule-design process more efficient.

A context rule contains rule conditions that hold the information needed to determine when a rule set must run in the Cart. Rule conditions evaluate logical expressions and examine specific information within a Salesforce object, such as an order, opportunity, or quote. Let’s learn more about it.

Context Dimension

A context dimension is a variable that describes the values available for a rule condition. You can reuse context dimensions across multiple rule conditions. The context rules engine compares the context dimension against data, for example, from a sObject, a function, or a static value defined in the context mapping.

Context Scope

A context scope describes the relational path from a root Salesforce object (opportunity, quote, order, asset) to related Salesforce objects. It sets the boundaries of how a rule works. Context scopes represent a Salesforce object used by the evaluation logic of rules to determine the output.

The diagram shows the root context scopes that Salesforce supports.

Salesforce Industries supported context scopes.

Salesforce Industries supports Order, Opportunity, Quote, Asset, and Any context scopes. You can also use Account and Contract context scopes, which use the root context scopes to determine the entity path to the required data element.

The Any context scope is a wildcard context scope that represents all root context scopes.

Any Context scope referencing account and contract scopes.

You can create Account and Contract scopes that are agnostic with regard to the root context scope. For example, instead of creating separate Order.Account and Quote.Account scopes, you can create a single Any.Account scope that locates the associated account for all root entities, including orders and quotes.

Context Mapping

Context mapping uses the context scope to identify the fields on sObjects to match against context dimension variables for evaluation by the context rules framework. It allows you to map context scopes, such as sObjects, with context dimensions, such as fields or calculated formulas. This way, you create a path to the data for the context rules engine, which forms a magic link between the data and the rules engine.

Context mappings are created from the context scope or context dimension and are held in the org cache. You learn more about this later in the module.

Looking Ahead

In this unit, you learned about the elements in the context rules framework and how they work together to filter products, promotions, price lists, and price list entries from the product catalog to the Cart.

With her new knowledge, Eliza gets to work by creating new context rules: one for a promotion and another for a price list. Follow along in the next unit and try creating a context rule yourself from the ground up.

Resources

Share your Trailhead feedback over on Salesforce Help.

We'd love to hear about your experience with Trailhead - you can now access the new feedback form anytime from the Salesforce Help site.

Learn More Continue to Share Feedback