Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

This content has been archived and is no longer being updated.

Links may not function; however, this content may be relevant to outdated versions of the product.

Declare Constraints rules and user input validation

Updated on May 3, 2020

Question

A developer asks:

We have a form with two input properties, Card Number and Authorization Code.  I planned to reference edit validation rules (Rule-Edit-Validate rule type) in those properties to ensure that the minimum length requirements are met (12 and 6 characters respectively). 

However, Guardrail #9 states "Whenever the value of a property is calculated or validated, use declarative rules whenever appropriate".  Yet in my Fast Track class, I recall advice to avoid Constraint rules for user input validation. 

Which approach is better in this case? The Rule-Edit-Validate approach seems to make more sense because the constraint rules involve the value of the property rather than a descriptive attribute such as length. 


 

 

Response

Constraints rules (Rule-Declare-Constraints rule type) are attractive because you can control more of what you compare, and you can create a better user interface.  No Java skills are required.

But depending upon how you define the Constraints rule, the system may execute the rule either every time the property is referenced or every time it changes. Such checking could impact system performance.

The recommended approach depends on how frequently the property value is presented and accessed.

  • Use Constraints rules unless there will be an impact on system performance.
  • Use Rule-Edit-Validate rules if your application doesn't require multiple, different validations for the data values, and if the Constraints approach could affect system performance

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us