Ruleset stack in pega

What is the ruleset stack in Pega?

Ruleset list or stack is assembled by Pega when the user logs into the application and ruleset stack are used during the rule resolution process. Rule resolution will be looking into the ruleset stack in a specific order so the order is important. Top Ruleset takes the highest precedence.

How Pega will assemble the Ruleset stack?

As we know each application is having a stack that is called the application ruleset stack. Application Stack contains application-specific rulesets and Organizational specific rulesets, combined we can call them as application ruleset stack. 

Let's see the below Application "OneHelp" which is built on OHFW framework application and Rulesets for OneHelp implementation application are :
  1. OneHelp,OneHelpInt - application ruleset for application configuration.
  2. PH, PHInt - organizational ruleset contains reusable organizational assets, such as data structures.
Application validation mode

OHFW framework application ruleset stack is shown below:

Application validation mode framework

Let's take the above application OneHelp is built on the OHFW framework application which is built on UIKit and UIKit is built on the PegaRULES application. Once the user logs into the OneHelp application we will see how Pega assemble the Ruleset stack for the operator. First, PegaRULES ruleset stack is added and on top of PegaRULES list UIKit ruleset stack, on top of UIKit OHFW ruleset stack and on top of OHFW list OneHelp application ruleset list, finally it will add if any personal ruleset (if we are allowed for the rule check out) with the name of the Operator.

ruleset stack










Below is the ruleset stack for the operator ohadmin when the operator logs into the application OneHelp.

ruleset stack for operator










Application Ruleset stack in Pega

We can view the Ruleset stack for the current application at Configure->Application->Structure->Ruleset stack

Summary: how the stack is built

  1. Pega starts with the lowest layer, the PegaRULES application and its rulesets.
  2. Each application built on top adds its own rulesets above the ones below it.
  3. The current application's rulesets come next, then any personal ruleset the operator is allowed to use, which sits at the very top.

How rule resolution uses it

When Pega needs a rule, it searches the stack from the top down, and within a ruleset from the highest version to the lowest. The first match wins. That is why the same rule name in a higher ruleset overrides one in a lower ruleset, and why a rule saved in the wrong ruleset can seem to change nothing.

A worked example

In the OneHelp example above, the stack from bottom to top is PegaRULES, UIKit, OHFW, then OneHelp. Suppose the section pyCaseHeader exists in UIKit and also in OneHelp. A user of OneHelp gets the OneHelp version, because it is higher in the stack. If a developer saves a change to the section into the OHFW ruleset instead, users will still see the OneHelp copy, and the change will look ignored.

Tips

  • Save rules in the ruleset where they belong: shared things in the framework or organisation layer, application-specific things in the implementation ruleset.
  • Use the Rule Inspector or the Rule resolution view to see which version of a rule is being used.
  • Keep the stack short and tidy. Fewer rulesets mean faster rule resolution and easier debugging.
  • Lock ruleset versions that are released, and put new work into a new version.

Interview tip

Explain that the stack is assembled at login and searched top-down by rule resolution. Then use the override example to show what happens when the same rule exists in two layers. Related: Enterprise Class Structure and the Pega Basics label.

6 comments:

  1. If my rule in
    onehelp:01-01-01
    PH:01-01-02
    which rule it will rule in priority wise

    ReplyDelete
    Replies
    1. First it will pick from OneHelp if the rule is not available in that then it will go to PH

      Delete
    2. Please go through Rule resolution process for more details..
      https://www.pegahelp.com/2020/07/rule-resolution-process-in-pega.html

      Delete
  2. Nice article on Ruleset stack.

    Here have a query in Application ruleset stack, after OneHelp and OneHelpInt directly Ph and PhInt are coming that are organization lever ruleset. Why does pega add organization level ruleset in application ruleset stack? Please explain.

    ReplyDelete
  3. Organization ruleset is intended to store the company wide data structures or integrations. Lets assume Amazon is a company and customerID is a property which can be used across organization. So we can create these properties in organization ruleset which can be accessed by other applications as well.

    ReplyDelete
  4. Organization ruleset is intended to store the company wide data structures or integrations. Lets assume Amazon is a company and customerID is a property which can be used across organization. So we can create these properties in organization ruleset which can be accessed by other applications as well.

    ReplyDelete