Professional Documents
Culture Documents
Creating A Rule Specialized by Circumstance
Creating A Rule Specialized by Circumstance
Note: The following content, referenced from Pega Community, is included here to help you better achieve the module
learning objectives.
Create a rule specialized by circumstance to provide a variant of the rule that your application triggers only conditionally
under specified conditions. By creating specialized or circumstance rules, you address dynamic business requirements
without changing the core logic of your application.
For example, in an application to review loan requests, additional processing can start only when the request amount
exceeds a value that you specify. You can also specify a time frame when the rule is active and available for rule resolution.
When you circumstance rules instead of applying other solutions, such as decision tables, you create an application that is
easier to maintain and edit if you need any adjustments in the future.
Before you begin: If you want to circumstance a rule by using a set of conditions, create a circumstance
template and definition. For more information, see Creating a circumstance template and Creating a circumstance
definition.
3. In the list of instances, click the rule that you want to open.
4. In the rule form header, open the new rule form:
If the rule is checked out, click the Down arrow next to theSave button, and then click Specialize by circumstance.
If the rule is checked in, click the Down arrow next to theSave as button, and then click Specialize by
circumstance.
5. Optional:
To provide information about the purpose of the new rule, in theLabel field, enter a new short description.
The identifier remains the same, even if you provide a new label.
6. Define circumstance conditions:
Choices Actions
At run time, your application resolves the rule if conditions from the definition evaluate to true.
Circumstance a. In the CIRCUMSTANCE BY section, select Property and Date.
the rule by
b. In the Property field, enter a property to evaluate at run time.
property
If you leave a date property blank, your application evaluates the specified time period against
the current system date.
If the rule is active during the specified time interval only, then at all other times, the base rule is
active. During rule resolution, if two or more date circumstance versions are candidates at the
current time and date, the application selects the candidates with the nearest end date. If
multiple remaining candidate rules have the same end date, the application picks the candidate
with the most recent start date. For more information about possible date combinations and the
business-logic requirements that they meet, see Date combinations and business requirements.
Note: In specific business scenarios, you can also circumstance rules by a combination of property and date.
7. Optional:
To override the default work item that your application associates with this development change, press the Down arrow
key in the Work item to associate field, and then select a work item.
For more information about your default work item, see Setting your current work item.
8. Update the values in the Context and Add to ruleset lists as appropriate.
9. Click Create and open.
Result: At run time, an application resolves the rule when the conditions that you specified evaluate to true. If the
conditions evaluate to false, the application resolves the base form of the rule.
Creating a circumstance template
Create a circumstance template to define a set of conditions that your application evaluates at run time to determine
whether a rule is available for rule resolution. By creating circumstance templates, you deliver a flexible application that
starts relevant processing under specified conditions, without implementing complex and advanced business-logic
solutions.
Creating a circumstance definition
Start relevant processing in your application only under specified conditions by creating a circumstance definition. When
you implement circumstancing in your application, you provide flexible solutions without defining complex logic. As a
result, you increase efficiency and design an application that is easier to maintain in the future if your business
requirements change.
Controlling the order of circumstance definitions
Provide relevant processing in scenarios when multiple conditions evaluate to true to ensure that users of your
application interact with intended data and application behavior. By defining the priority of circumstance definitions, you
determine how your application behaves when more than one definition meets specified conditions.
Creating a redirected rule
To create redirected rules, which are circumstance rules that are configured to reference other circumstance rules for
the same base rules, complete the following tasks.
Base rules
A base rule is the fallback rule selected by rule resolution when no other circumstance version's criteria is met. Base
rules have no circumstance qualification.
Finding rules by circumstance
To verify if an existing rule is either a base rule or a circumstance, open it in Dev Studio and inspect the form header.
Click the Circumstanced link to see circumstance values or an indication that the rule is a base version. The link does
not appear if the existing rule is neither a base nor a circumstanced version.
Specializing a case type
Specialize a case type to support variations in the way that cases are processed in your application. Each version that
you create is uniquely identified by a circumstance.
Rule resolution exceptions
Understanding rule resolution ranking exceptions can help you troubleshoot unexpected rule resolution results.
Setting rule status and availability
Set rule status and availability to elaborate on the usage information that you provide, and ensure that users interact
with the correct version of your rule at run time. By setting rule status and availability, you also define application
behavior during rule resolution, and how users can interact with rules at design time. As a result, you ensure that your
application works correctly even if users apply extensions and make modifications.
Creating a rule
To save time and ensure that your projects adhere to the unique needs of your clients, create rules and data instances
using reusable elements of your application. By combining a rule type, name, class, and ruleset, you provide a unique
identity for each rule that you create.
Rule resolution exceptions
Understanding rule resolution ranking exceptions can help you troubleshoot unexpected rule resolution results.
Circumstance rule examples
Assume that you have different 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 circumstanced instances of the base rules as shown
here:
Circumstance templates
Use a circumstance template rule to identify properties for multivariate circumstanced rules. A circumstance template
rule contains an array of properties such as .State, .Channel, and .ClaimAmount that reference property values in one
or more circumstance definition rules. These rules define the value combinations for each of the properties defined in
the circumstance template rule.
Create a rule specialized by circumstance to provide a variant of the rule that your application triggers only conditionally
under specified conditions. By creating specialized or circumstance rules, you address dynamic business requirements
without changing the core logic of your application.
For example, in an application to review loan requests, additional processing can start only when the request amount
exceeds a value that you specify. You can also specify a time frame when the rule is active and available for rule resolution.
When you circumstance rules instead of applying other solutions, such as decision tables, you create an application that is
easier to maintain and edit if you need any adjustments in the future.
Before you begin: If you want to circumstance a rule by using a set of conditions, create a circumstance
template and definition. For more information, see Creating a circumstance template and Creating a circumstance
definition.
3. In the list of instances, click the rule that you want to open.
4. In the rule form header, open the new rule form:
If the rule is checked out, click the Down arrow next to theSave button, and then click Specialize by circumstance.
If the rule is checked in, click the Down arrow next to theSave as button, and then click Specialize by
circumstance.
5. Optional:
To provide information about the purpose of the new rule, in theLabel field, enter a new short description.
The identifier remains the same, even if you provide a new label.
6. Define circumstance conditions:
Choices Actions
At run time, your application resolves the rule if conditions from the definition evaluate to true.
Circumstance a. In the CIRCUMSTANCE BY section, select Property and Date.
the rule by
b. In the Property field, enter a property to evaluate at run time.
property
If you leave a date property blank, your application evaluates the specified time period against
the current system date.
If the rule is active during the specified time interval only, then at all other times, the base rule is
active. During rule resolution, if two or more date circumstance versions are candidates at the
current time and date, the application selects the candidates with the nearest end date. If
multiple remaining candidate rules have the same end date, the application picks the candidate
with the most recent start date. For more information about possible date combinations and the
business-logic requirements that they meet, see Date combinations and business requirements.
Note: In specific business scenarios, you can also circumstance rules by a combination of property and date.
7. Optional:
To override the default work item that your application associates with this development change, press the Down arrow
key in the Work item to associate field, and then select a work item.
For more information about your default work item, see Setting your current work item.
8. Update the values in the Context and Add to ruleset lists as appropriate.
9. Click Create and open.
Result: At run time, an application resolves the rule when the conditions that you specified evaluate to true. If the
conditions evaluate to false, the application resolves the base form of the rule.