Skip to main content

Creating a circumstance definition

Pega Community logo

Note: The following content, referenced from Pega Community, is included here to help you better achieve the module learning objectives.

Begin 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.

For example, in a banking application, if your circumstance template includes a LoanAmount property, and the definition includes the value 5000 with an operator >, the application resolves the circumstance rule only when the loan request amount is greater than 5000.
Before you begin: Create a circumstance template that stores properties to evaluate by the circumstance definition. For more information, see Creating a circumstance template.
  1. In the header of Dev Studio, click Create Technical Circumstance Definition .

  2. On the Create Circumstance Definition form, enter values in the fields to define the context of the definition:

    1. In the Label field, enter text that describes the purpose of the circumstance definition.

    2. Optional:

      To change the default identifier for the circumstance definition, click Edit, and then in the Identifier field, provide a unique value.

    3. In the Template Name field, press the Down arrow key, and then select the circumstance template that your circumstance definition implements.

    4. In the Context section, select the application to store the template.

    5. In the Apply to field, press the Down arrow key and select the class that defines the scope of the circumstance definition.

    6. In the Add to ruleset field, select the name and version of a ruleset that stores the circumstance definition.

    7. Optional:

      To override the default work item that your application associates with this development change, in the Work item to associate field, press the Down arrow key, and then select a work item.

      For more information about your default work item, see Setting your current work item.

  3. Click Create and open.

  4. On the Definition tab, click the column header to choose which operations the column supports:

    • For columns that evaluate properties from the template against a single value, select an operator from the Use Operator list, for example >.
    • For columns that evaluate properties from the template against a range of values, select the Use Range check box, and then choose operators from the Starting Range and End Range lists, for example >= and <=.
  5. Click Save.

  6. Click a cell in a table that you want to define, and then enter a value or an expression that evaluates properties in the template.

    For example: To evaluate loan amounts greater than 5000, use a single operator >, and then enter 5000.
  7. Optional:

    To provide more values for evaluation, add rows to the table:

    • To add a row before the current cell, on the toolbar, click Insert Row Before, and then repeat step 6.
    • To add a row after the current cell, on the toolbar, click Insert Row After, and then repeat step 6.

    Note: As your application evaluates the table from top to bottom, to save time and resources, place the most likely outcomes at the top of the table.
  8. Optional:

    To ensure that your application can process the table, check the table for conflicts by clicking Show conflicts on the toolbar.

    Note: A warning icon appears in rows that are unreachable or empty.
  9. Click Save.

Note: At run time, an application evaluates the values from the circumstance definition against the properties in the circumstance template and resolves the rule only when the values evaluate to true.

  • 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 definitions

    A circumstance is an optional qualification available for supported rule types and is built upon the base rule.

  • Date combinations and business requirements

    The following table lists the possible date combinations and the business-logic requirements they meet when you circumstance by date.

  • Changing the scope of rules

    Adjust your application to your specific business needs by changing scope of rules. For example, you can move a rule to another ruleset or class, so that you can reuse the rule in a different part of your application.

  • 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.

  • Building logic and calculating values in your application

    Provide automations for calculating values and implementing logic so that your application can flexibly respond to unique conditions at run time. For example, you can create a process of transforming data, and, as a result, present users with relevant information when they perform work.

If you are having problems with your training, please review the Pega Academy Support FAQs.

Did you find this content helpful?

50% found this content useful

Want to help us improve this content?

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

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice