When condition rules
A when condition rule evaluates a Boolean logical statement that involves comparisons among values of properties, to return true or false. To create more sophisticated logic, you can create multiple conditions, and then apply grouping that meets your business requirements.
For example, a when condition rule returns true when a job applicant has working experience greater than 10 years, and when the applicant is fluent in speaking French.You can apply when condition rules in multiple places of your application to define adjustable and flexible logic.
Elements of when condition rules
When condition rules are Boolean expressions that consist of three elements:
- An input value to compare at run time, for example a value of a field that a user completes.
- A comparator, for example is greater than or is equal to.
- A test value to compare against the first value from the condition.
Input for when condition rules
As an input value for a when condition rule, you can use a field, a configuration, or another when condition. When you build a when condition by applying another when condition, you define whether the input when condition needs to evaluate to true or false at run time, instead of selecting a comparator and a test value. For example, you can create a when condition CaseStatus is true, where CaseStatus is another when condition in which CaseStatus is equal to "Pending-Review". In this scenario, the CaseStatus is true when condition evaluates to true if the case status is Pending-Review. For a facilitated development experience, you can easily preview the when condition that you apply as an input value, as shown in the following figure:
Grouping conditions
You can group conditions by applying AND and OR elements.
Where referenced
Rules of many other rule types can reference when condition rules. For example, you can reference when condition rules in activities, flows, and through the <pega:when > JSP tag in HTM and XML rules.
Access
Use the Application Explorer to access when condition rules that apply to the work types in your application. Use the Records Explorer to list all when condition rules available to you.
Development
Many when condition rules can be conveniently expressed as one or more Boolean expressions (comparisons or function calls) ANDed or ORed together. Use the Conditions tab to enter or update such rules. Other when condition rules require more complex logic to combine the Boolean expressions. Use the Advanced tab to enter or update those rules.
Delegation
After you complete initial development and testing, you can delegate selected rules to line managers or other non-developers. Consider which business changes might require rule updates and if delegation to a user or group of users is appropriate.
For more details, see Delegating a rule or data type.
Category
When condition rules are part of the Decision category. A when condition rule is an instance of the Rule-Obj-When rule type.
- Creating a When rule
Evaluate a Boolean logical statement that involves comparisons among values of properties, to return true or false, by creating a When rule.
- Defining conditions for a When rule
Enter or revise a When rule that can be expressed as a single Boolean expression or the conjunction (AND or OR) of one or more Boolean expressions.
- Editing a When rule in the legacy mode
Apply functions and more advanced logic in When rules by editing the conditions in the legacy authoring mode.
- Configuring advanced options of a When rule
Define complex logic strings and use functions in conditions by configuring advanced options of a When rule.
- Specifying pages and classes of a When rule
Ensure that a When rule accesses or updates information on clipboard pages by specifying the page name and class of the pages. At run time, these pages contain the properties that are referenced on the other tabs of a When rule.
- More about When Condition rules
You can compare the value of one property reference against a literal constant, or against the value of another property reference. If you define more than one comparison, you can combine the results with and, or, and not operations to determine the final true/false outcome.
Previous topic Unit testing a map value Next topic Creating a When rule