Authored by Alexander Nelson
Custom guardrails can be built and called by the OOTB placeholder CheckForCustomWarnings, which is called on each click of Save.
Use case examples
During development it may be beneficial to guide development processes and enforce best practices by adding warnings and messages at the time of rule creation or modification. These warnings may then be removed post development or considered to remain for consistency in future development.
For example, it is discovered that recently developed rules have inconsistent use of activity step description and the rule History field is either blank or copy/pasted in the Usage field. It is also desired to have spacing between the words in the Label ID and that all commented code be evaluated for removal. Additionally, developers may wish to have the "Allow Direct Invocation" configuration tracked for testing and development.
Before you begin
Is it necessary to plan anything in advance, or are external steps using other tools required to achieve the goal? If any specific configuration procedures (how-tos) exist on the Pega Community pages, you can link to those assets here by providing the URL.
Process/Steps to achieve the objective
This example will create varying messages as structured in the below diagram 1.1.

Extend placeholder
- Perform a Save as on the OOTB placeholder activity CheckForCustomWarnings in Rule- or the class of the rule to be evaluated. This gets called on every click of Save.
- Create an activity such as CheckForExtendedWarnings in the class of the property to be evaluated.
- On the CheckForCustomWarnings activity step, call CheckForExtendedWarnings.
- On the CheckForExtendedWarnings activity step, set the Step Page, Loop and When conditions and call the Function: Add a message to a page using [Name of message rule].
- Create a Message rule (called from the previous Function) and set the Category, Severity and Application Impact using drop-down selections. Type the message to be displayed in the Message field.
Direct invocation
Display warning conditional on checkbox property.
- (2.1) Two steps use the methods Property-Set and Call-Function.
2.1 Two steps use the methods Property-Set and Call-Function. - (2.2) Set a When condition - "Enable conditions before this action".
2.2 Set a When condition - "Enable conditions before this action." - (2.3) Message created in @baseclass and called from a step in CheckForExtendedWarning.
2.3 Message created in @baseclass and called from a step in CheckForExtendedWarning. - (2.4) TEST: The box "Allow direct invocation from the client or a service," when unchecked, should display a warning.
When Save is clicked on a rule, conditions are checked and a warning displays.
2.4 For testing, the box "Allow direct invocation from the client or a service," when unchecked, should display a warning.
History usage and description
Display a warning if the description and usage are null.
- (3.1) Two steps use the methods Property-Set and Call-Function.
3.1 Two steps use the methods Property-Set and Call-Function. - (3.2) Set a When condition on the Call-Function step.
3.2 Set a When condition on the Call-Function step. - (3.3) Message created in @baseclass and called from a step in CheckForExtendedWarning.
3.3 Message created in @baseclass and called from step in CheckForExtendedWarning - (3.4) TEST: Leave either the Description or Usage fields blank and click Save.
3.4 TEST: Leave either Description or Usage fields blank and click Save
History usage and description identical
Display a warning if description and usage are identical.
- (4.1) Two steps use the methods Property-Set and Call-Function.
4.1 Two steps use the methods Property-Set and Call-Function. - (4.2) Set a When condition on the Call-Function step.
4.2 Set a When condition on the Call-Function step. - (4.3) TEST: Copy/paste identical content into the Usage and Description fields. On save, a message is displayed.
4.3 Identical Description and Usage Message.
Label same as ID
Displays a warning when the label is not spaced between words similarly to ID.
- (5.1) Two steps use the methods Property-Set and Call-Function.
5.1 Two steps use the methods Property-Set and Call-Function. - (5.2) Set a When condition - "Enable conditions before this action."
5.2 Set a When condition - "Enable conditions before this action." - (5.3) Message created in @baseclass and called from step in CheckForExtendedWarning.
5.3 Message created in @baseclass and called from the step in CheckForExtendedWarning. - (5.4) TEST: Edit the label to match the ID.
5.4 TEST: Edit the label to match the ID.
Commented steps
Displays a warning when activity steps are commented out (//).
- (6.1) Two steps use the methods Property-Set and Call-Function.
6.1 Two steps use the methods Property-Set and Call-Function. - (6.2) Set a When condition - "Enable conditions before this action".
6.2 Set a When condition - "Enable conditions before this action". - (6.3) Set parameters in parameter tab.
6.3 Set parameters in the Parameters tab. - (6.4) Check each step recursively. (See diagram 1.1 for illustration.)5
6.4 Check each step recursively. - (6.5) Message created in @baseclass and called from step in CheckForExtendedWarning.
Message created in @baseclass and called from a step in CheckForExtendedWarning. - (6.6) TEST: Comment step and save. Warning will display.
6.6 TEST: Comment a step and save. Warning will display.