Back Forward How to classify and select rules based on Custom Field values

Basics

C-1844 Advanced featureCustom fields offer application developers a flexible way to associate a set of labels and values with a rule, for classification or to supplement other facts in the rules.

Custom Fields offer a flexible facility for categorizing rules in an application, or for supplementing rules with metadata. These fields have multiple uses. For example, a file containing design notes, testing notes or change order details can be linked to a rule as the value of a Custom Field.

Custom fields for a rule appear on the right side of the History tab.

Associating Custom Fields and field values with a rule

Each Custom Field has two parts, a name and a value. The value may be a text string or a file.

Developers can add or delete new Custom Fields for a rule instance, and can change the values. See How to complete and use the History tab of a rule form.

Updating Custom Fields of type Text

When a rule instance contains a Custom Field of type Text (rather than File), any user or developer who can update the leftmost tab of the rule can also update the text value.

When a decision rule, for example, is delegated to a manager to maintain, the manager can update information in the leftmost tab of the rule and can change the value of Custom Fields. Custom fields appear at the bottom of the header tabs of the rule form. (From the header of the form, you cannot add or delete Custom Fields.)

See:

Overriding the default presentation of Text Custom Fields

Your application can customize the presentation of the Custom Fields area on the header of a rule form, to provide audience-specific labels and validation. For more information, see Pega Developer Network article PDNPRKB-17693 How to allow developers to review or update Custom Field values.

  1. Create an HTML rule by copying the standard rule Embed-CustomFields.defaultFields into your application, with a Stream Name of your choice.
  2. Update the HTML text to provide the desired presentation, including layout, styles, and labels. The HTML code in this rule is eventually included within other rules; it does not define a full document.
  3. Copy the standard decision tree rule named Rule-.getCustomStreamName into your application RuleSet, retaining both key parts so that your rule overrides the standard rule.
  4. Update the copied decision tree rule to choose your custom HTML rule rather than the standard rule when desired.

Searching for Custom Fields by Value

A developer can search for rules that contain a specific Custom Field value. Select> Process and Rules > Find Rules > Find by a Custom Field to start a wizard. not working ?

To filter by a custom field value, the custom field must be a database column in table pr_index_customfields. If you add new custom fields and you want to report on them, expose them as columns. B-21156 KARAF 7/27/06 SR-3872

By default, this facility only searches rules types that belong with the Decision category. Your application can override this behavior by overriding the standard list view rule named Rule-Obj-Class.getCategorizedRules. KARAF 3/21/05

Internals

The system stores custom field links as instances of the Index-CustomFields class, as elements of the @baseclass.pyCustomFields property, a Page Group property. Physical storage within the PegaRULES database uses the pr_index_customfields table.

For Text types, the system saves both the name and the value with the rule. When you upload a file as the value of a custom field, Process Commander automatically creates a binary file rule instance containing the file and links the rule to the binary file rule.

New Custom Fields can be created by those who have the ability to create new properties. B-9291 NJENC

Related topics Working with the PegaRULES database — Link- and Index- Tables

UpDesigner Studio basics