What is circumstance in Pega?


Staff member
A circumstance is an optional qualification available for supported rule types. Commonly referred to as a "circumstanced" or "specialized" version, a circumstance is based upon an unqualified rule known as the base rule.

Using circumstances in your application allows you to easily support a variety of use cases. For example, you may want a different data transform to execute depending on a customer's geographic location (i.e. when .StateCode = "MA"). Instead of maintaining the logic for all cases in one large rule, start with a base rule and extend (or specialize) it as needed. At runtime, PRPC automatically selects the correct version to execute as part of its rule resolution process.

There are many options available for circumstancing or specializing a base rule including:

One single value property

Multiple single value properties, also known as multivariate

Date property

Date range

To verify if an existing rule is either a circumstanced version or is a base rule, open it in the Designer Studio and inspect the form header. The Circumstanced link will appear; click it to see the circumstance values or an indication that the rule is a base version. If the existing rule is neither a base nor a circumstanced version, the link will not be visible.

To see all available circumstances for a given base rule, navigate to the rule in the Application Explorer. Use the expand icon next to the name of the base rule to display each of the circumstanced instances and their values.

Assume that you have difference pricing levels for your customers. You first define a base pricing rule for all customers. Then you qualify the base rule by creating circumstanced rules for customers at different buying levels. The property .CustomerType is part of the customer order and has values of "Silver" and "Gold". In this example, a customer has purchased a $100 item. Using the property and values, you create circumstance-qualified instances of the base rules as shown here:

BasePrice rule — if .CustomerType=(none), then Price =$100

BasePrice circumstance 1 — if .CustomerType = “Gold”, then price = $100 - 25%

BasePrice circumstance 2 — if .CustomerType =“Silver”, then price = $100 - 10%

When the system processes the order, the value of that property dictates which rule is run and thereby determines the discount (if any) the customer receives.