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 revalidate all rules in a RuleSet

Updated on September 10, 2021

Summary

Using a list view report on rules, a 5-step activity, and an HTML rule, you can revalidate all rules in one RuleSet, one RuleSet version, or a specific list of RuleSet versions.

The activity provides a comprehensive check of all rule types, in contrast to the Revalidate and Save tool which operates only on one rule type at a time.

If any rules fail validation, investigate and repair as needed. While validation does not ensure that a rule produces "correct" or "intended" results, execution of invalid rules is undesirable and often fails or produces incorrect results without warnings.

 

Suggested Approach

Each time a developer attempts to save a rule form, Process Commander performs numerous validation checks. Only rules that pass all these checks are saved.

So by definition, every saved rule was valid at one time, in a certain Process Commander system, when it was saved in a specific environment of other rules. However, at later times, or in other environments or other systems systems, a rule that was previously valid may become invalid. For example, rule ALPHA can become invalid if ALPHA depends on rule BETA but rule BETA was deleted after ALPHA was saved.

You can use the the built-in revalidator tool (accessed from the Developer portal menu Tools > Revalidate and Save ) to revalidate each rule of a single rule type in your RuleSets. For example, with this tool you can easily revalidate all the properties, or all the decision table rules, in one RuleSet. Revalidation adds a memo to the history of each rule that passes, even if the rule belongs to a locked Version.

However, it is sometimes helpful to revalidate all rules that meet specific criteria, such as all rules in a RuleSet, all rules updated since a specific date, or all rules updated by a specific developer.

The Data-Rule-Summary class supports reports on rules. (This class is linked to a database view, not a database table, in the PegaRULES database. See Related topics). If you can specify a set of rules to revalidate using exposed properties in this class, you can use the approach in this article.

Step 1: Create a List View report

1. Create a list view report with Data-Rule-Summary as the Applies To key part.

2. On the Content tab, create selection criteria that together define the subset of rules you want to revalidate.

Choose selection criteria carefully to restrict the number that quality. Remember that Process Commander systems contain tens of thousands of rules. The approach in this article has been tested with up to 1,000 selected rules.

The database view pr4_rule_vw, corresponding to the Data-Rule-Summary class, includes 20+ properties exposed as columns, including:

  • pyRuleSet
  • pyRuleSetVersion
  • pxUpdateDateTime
  • pxUpdateOperator
  • pxClass (text such as "Property" or "Activity")
  • pzInsName

In this example, the selection criteria includes all rules associated with a single RuleSet (provided as a parameter value to the list view rule), up to the default limit of 500.

Content tab

3. Choose a memorable name for the top-level page produced by the list view rule. Enter this name in the Content Page Name field at the bottom of the Content tab.

4. Include the pxInsName property (known as the visible key) and the pyClass property in both the Get These Fields array (on the Content tab) and the Display These Fields array (on the Display Fields tab). Other outputs are optional.

5. Ensure that paging (on the Organize tab) is not enabled.

6. Test the list view rule using the Run toolbar icon to

Step 2. Display validation failures with an HTML rule

When executed, the list view rule creates a clipboard page of class Code-Pega-List, with one embedded page pxResults(1), pxResults(2)... of class Data-Rule-Summary for each selected rule. Validation errors appear as page messages on individual pxResults() pages.

1. Create an HTML rule in the @baseclass class to present the validation results.

In this example, a <pega:forEach ...>JSP tag loops through the embedded pages, and presents one row of a <TABLE> identifying the rule.

HTML rule 1

3. Complete the Pages & Classes tab, identifying the class of the top-level page and of the embedded pages.

4. Save the HTML rule.

5. Click the Run toolbar tool to test, using as input the clipboard page created by the list view report. (The Messages column of the output table will be empty.).

Step 3. Use an activity and loop to revalidate each rule

1. Create an activity with Data-Rule-Summary as the Applies To key part.

2. Define parameters RuleSet and Memo to control the report selection criteria and the memo text. A single parameter page is shared among this activity, a standard activity called in activity step 3, and the list view rule.

Parameters

3. On the Pages & Classes tab, identify the class of the list review results and of the pxResults pages:

Pages & Classes

In step 1, set the values of 4 additional parameters to the standard activity Rule-Obj-List.ShowView using the Property-Set method.

Set parameter pyAction to "Prepare".

Step 1

In step 2, call Rule-Obj-ListView.ShowView, sharing the parameter page.

Step 2

 

In activity Step 3, use a For Each Embedded Page iteration. Repeatedly call the standard activity @baseclass.BulkValidateSave to validate the rule identified on a pxResults page. Pass as parameters the pzInskey of the rule to be validated, and the memo parameter.

In activity Step 4, display the results using the Show-Stream method with the HTML rule you created earlier.

Activity step 5 removes the top-level clipboard page, to clean up.

Steps 3, 4, 5

Step 4. Test

Save the activity form. Click the Run toolbar button and enter parameter values:

Enter parameters

Processing may take several minutes, depending on the number of rules in the RuleSet. Eventually, the output appears, identifying each rule and validation messages:

Output

For rules that passed validation, a memo is added to history.

To see this memo, open a rule, click the History tab, then click History Details.

 

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