In this post, I am sharing how to customize (add or remove) Guardrails warnings.
(1) Adding your custom Guardrail warnings
Create an activity named "CheckForCustomWarnings" in the Rule class where you want to add warnings to (don't be confused with "CheckForWarnings", which should already exist in all Rule classes. Since it is Final, you can never override it). For example, if you want to add warnings to Flow action, create it in Rule-Obj-FlowAction class. Write a Java code as below, and configure When condition.
After this implementation, if you leave description of flow action rule blank, system will give a severe warning as below.
(2) Remove out-of-the-box Guardrail warnings
It is not recommended to remove the out-of-the-box warnings, as they are intended to check if developer's code is complying with good practices. However, in unusual circumstances you may want to do so. For example, recently I have found a product issue in warning logic - when you do Obj-Browse, if you specify a property (optimized) under a Single Page for filtering, system throws "pzObjBrowse-InvalidProp" SEVERE warning for no reason. This was actually acknowledged as a product defect (INC-159925) and will be fixed in the future release. We can justify it for the time being, but I would rather want to eliminate it as it is still counted as warnings.
In such cases, you can suppress the warnings. Create an activity named "CheckForCustomWarnings" in the Rule class where you want to remove warnings from. For above example, place it in Rule-Obj-Activity class. Then write a Java code as below.
Replace "pzObjBrowse-InvalidProp" with the warning name that you want to get rid of. If you want to suppress multiple warnings, concatenate them by || (OR) operator.
***Edited by Moderator: Pooja Gadige to add platform capability tag, add Developer Knowledge Share tag***
When condition just checks if description is blank or not, as shown below. I've also updated my original post with screenshot.
For your question, I do not know your definition of "property is being used", but whatever it is, create an activity named "CheckForCustomWarnings" in the Rule class and configure When condition so it detects your definition. With that said, if I don't want anyone to use a particular property, I would just delete / withdraw it.
Hope this helps.
Posted: 1 month ago
Posted: 10 Aug 2022 6:03 EDT
Michael Tan (tanm1)
Senior System Architect