Skip to main content
Verify the version tags to ensure you are consuming the intended content or, complete the latest version.

Rule reuse through inheritance

Inheritance methods

Inheritance allows your application to reuse existing rules for other cases or applications. Rule reuse through rule inheritance reduces development and testing time without sacrificing application quality.

Note: Determine the reusability of the rule to decide where the rule should be placed in the class and ruleset hierarchy.

Pega Platform™ provides two methods for rule inheritance: pattern inheritance and directed inheritance.

Pattern inheritance

Pattern inheritance is automatic. Pattern inheritance uses the existing class name structure to determine which rules are available for reuse. Pattern inheritance searches classes that share a class name prefix. Pattern inheritance promotes reuse based on business suitability because rules are aggregated at higher levels to reflect their usability throughout an entire division or organization. For example, a rule applied at the division level that defines elements of payment processing for insurance claims can be reused by each claims department belonging to that division.

The following image illustrates a basic pattern inheritance hierarchy for an insurance company (ABCIns) and two of its divisions: Consumer and Business. The ABCIns class is the parent class to two child classes (ABCIns-Consumer and ABCIns-Business) which are themselves the parent classes to ABCIns-Consumer-PolicyProcessing and ABCIns-Business-PolicyProcessing, respectively.

In the following image, click the + icons to learn more about pattern inheritance.

Directed inheritance

Directed inheritance is inheritance between classes where the parent class is explicitly specified, unlike pattern inheritance, which is automatic. You apply directed inheritance to reuse standard Pega Platform rules and rules from other applications outside the business class hierarchy. You list directed inheritance on the class rule form. Because rules are aggregated based on whether they apply to all cases or cases of a certain type, directed inheritance promotes reuse based on functional suitability.

For example, a rule may be limited to a specific implementation, such as an auto insurance application, or applied to all implementations, including applications for property and marine insurance.

Class rule with directed inheritance

Directed inheritance is the option that allows an application class to inherit rules defined for standard Pega classes, such as the Work- or Data- class.

Note: Set the rules in a higher parent class if you anticipate reusing them to avoid duplicate rules. When creating a new rule that is similar to an existing rule, refactor the rule to use parameters instead of creating multiple versions of the rule. 

For example, consider an organization named TGB that has an IT application with Ticket cases and an Accounting application with Purchase Request cases. Both the Ticket and Purchase Request case types use a property, .pxCreateOpName, to record the name of the operator that creates the case. Through directed inheritance, both cases inherit the property which is defined in the Work-Cover class.

TGB example showing pattern and directed inheritance

Check your knowledge with the following interaction:

Inheritance and rule reuse

Pega Platform first searches through the parent classes indicated by pattern inheritance when reusing rules through inheritance. If unsuccessful, Pega Platform then searches the parent class indicated by directed inheritance as the basis for another pattern inheritance search. This process repeats until the system reaches the last class in the class hierarchy, called the ultimate base class or @baseclass. If the system cannot find the rule after searching @baseclass, Pega Platform returns an error.

Consider the following example in which an auto insurance claim case references the field that stores the case ID. The application containing the auto insurance claim is built on a generic policy administration application. That generic application is built on the Pega Platform.

In the following image, click the + icons to learn more about how Pega Platform searches for the case ID.

Check your knowledge with the following interaction:

This Topic is available in the following Module:

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

Did you find this content helpful?

100% 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