Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

This content has been archived and is no longer being updated.

Links may not function; however, this content may be relevant to outdated versions of the product.

How to create a rule with multiple circumstance properties

Updated on September 10, 2021


Summary

After creating a rule, you can define qualifiers (such as circumstances) which may be used to create additional versions of your rule for specific situations. 

Before trying to add multivariant circumstancing to a rule, verify that all the appropriate rule design decisions have been made (see Before You Begin, below).  In addition, you must define the following rules before creating the multi-circumstanced rule:

 

Suggested Approach

 

Before you begin

Before you create a rule with multiple circumstanced properties, you must:

Determine how to group the rule processing

Organize your rules into the most efficient grouping, to minimize the number of rules you need to create.  For example, suppose you were creating a rule that would calculate an invoice and apply the state tax; your properties are the state name and the tax rate. 

There are 50 states.  Rather than creating 50 different versions of the rule, see if some states have the same tax rate.  You may find that 30 states have a 5% rate; 10 states have a 7.5% rate; and the remaining 10 states each have a different rate (2%, none, 4%, etc.). 

Thus, since the majority of the states have a 5% rate, make that the “standard” rate in the base rule.   Create a circumstanced rule to apply to the 10 states with the 7.5% rate, and then one rule for each of the other different states.  This leads to one base rule and 11 circumstanced rules, which is much easier to keep track of than 50 rules.

 

Create the base rule

Circumstanced rules require a base rule be present (so if none of the circumstanced rules are valid in the present case, there is still a rule to run.  See Understanding circumstances and other rule qualifiers).  Before creating the circumstanced version of a rule, create the base rule.

Create the rule

1.  Open the base rule on which you wish to define a circumstanced rule.

2.  Click on Save As to save the rule.  The Save Rule Instance under new key dialog box appears.

3.  If desired, change:

  • the Applies To class name
  • the RuleSet Name
  • the RuleSet Version

Important:  For a valid circumstanced rule, these values may only be changed to a descendant of the value in the original rule.  For example, if the original rule is defined on the PegaSample class, the circumstanced rule may be defined on PegaSample, or it may be defined on PegaSample-Task or any other rule that inherits from PegaSample.  If the circumstanced rule is defined on Work-, for example, it will be considered a completely separate rule and would not be considered as a circumstance of the base PegaSample rule during rule resolution at runtime.

4.  Expand the Circumstance section of this form by clicking on the arrow to the right of the Circumstance label.

5.  Choose Template from the Use dropdown box.

6.  In the Template field, enter the name of the Circumstance Template you created. 

7.  In the Definition field, enter the name of one of the Circumstance Definitions you created.

8.  Click the Save As toolbar button.

NOTE:  Once you have created the first multi-circumstanced rule, then choosing Save As to create additional copies of that rule will display a dropdown with the previously-chosen Circumstance Template, instead of a field with a SmartPrompt.

Once you choose the property, additional Circumstances Definitions associated with that Circumstance Template will display in the Definition field:

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us