Examples and Configuration of Custom Guardrails Pega 8.3
We have discussed creating custom guardrail messages to alert and provide details to client developers when deviating from project prescribed best practices. We have created a list of implementations we would like to start with and have seen the Pega "Guided Development Through Guardrails" and other similar posts. However, we have not found enough clarity or detailed configuration steps in currently existing documentation from any of the previously posted resources in community or academy. Some appear to be older versions not applicable to 8.3 and mention newer methods. It appears it is not a complicated process but I could use a very detailed process to provide additional clarity to at least get one example running.
One such example would be when creating an activity, each activity steps' description field must be used to clearly define the purpose of the step.
Does anyone have detailed examples or steps on how to configure this or other custom/extended Guardrails and messages? I feel it would be a tremendous help for this project and creating a collection with detailed how-to would be a great resource for everyone on future projects.
Custom guard rail warnings can be added to augment the standard warnings. To add a rule warning condition involves two steps:
Step 1: Creating an activity named CheckForCustomWarnings in the Applies To class of the rule type.
When ever we try to Save/ SaveAs any rule in pega, it calls the standard activity called CheckForCustomWarnings for validating the rule. This activity will be triggered from one of the standard activity called StandardValidate .
Copy this rule to the class of the required rule type which we want to add the warning. Consider an example, we want add a guardrail warning to the data transform, if its don't have any description in the history. Save the activity "CheckForCustomWarnings" in the rule type class of data transform i.e., "RULE-OBJ-MODEL"
Step 2: Configure the activity with a Java step to call the standard function rule addWarning.
In the first step of the activity, check for the missing description of the data transform rule. If the description property has value, exit the activity otherwise set the properties for the warning. The second is a java step that adds warning using a standard called "addWarning"
Parameters for the addWarning function:
WarningName – Name of the warning
WarningMessage – Actual warning message
WarningDetails – Extra details to be shown
WarningType – Group warnings together in reports (Performance, BestPractice, DataIntegrity, Deprecated, and Logic)
Severity – Defines the severity from 1 to 3 where 1 is most serious
myStepPage – Page the warnings are added to, pass in the primary page here