Data validation against a pattern
Role of edit validate rules in data validation
In applications, you use validation to minimize the errors that can occur when users submit erroneous data. For example, during case processing, users must enter their Social Security number (SSN). You want to ensure that users enter an SSN in the correct nine-digit format that is divided by hyphens: 111-11-1111. To achieve this validation, you use an edit validate rule, which is a rule type that validates character patterns. When users enter an SSN in the wrong format and click away from the field, an error message is displayed.
Tip: Pega Platform™ provides predefined edit validate rules for commonly-used patterns. For example, edit validate rules can validate whether the property input is an SSN, Taxpayer Identification Number (TIN), or US-based phone number.
Other common types of validation restrict the choices available to users. For example, developers can specify a Date/Time property type to ensure that users enter only a valid date, or determine that a property uses a drop-down list control to limit users to approved choices. In contrast, edit validate rules do not restrict the values that the user can enter; they validate based on the data format.
Caution: Edit-validate rules use Java, so if you want to create your own edit validate rule, you must have Java programming knowledge.
Edit validate rules are defined on properties, and not on activities or flow actions. Edit validate rules are used for client-side validation, which means that the value users enter is validated immediately without referencing the server. Validation occurs when users make a change to the entered value. To apply an edit validate rule to a property, reference the edit evaluate rule on the Advanced tab of the property rule form, in the Use validate field. The following example shows a property rule for capturing a postal code, with an edit validate rule applied to verify that entered values match the US ZIP Code format.
Note: To defer validation of the value of a field, you can configure a validate rule to call one or more edit validate rules. When you call an edit validate rule from a validate rule, the contents of the field are validated when the form is submitted, rather than when the user changes the value of the field.
Check your knowledge with the following interaction.