Valid data is required so that the system can process the information without error. To prevent processing errors, Pega Platform provides field types and controls to support validation requirements.

Pega provides validate rules and edit validate rules. Validate rules are different from edit validate rules. Edit validate rules require Java programming skills to develop. Validate rules can call edit validate rules.

Example of validate rule – comparing two date , we can use the function available in pega

Example of edit validate rule – To check a number is positive or not

Example Scenario 

User A is entering his passport in the application. It showed a certain format for passports .

Valid passport of india should meet the following condition

  • It should be eight characters long.
  • The first character should be an uppercase alphabet
  • The next two characters should be a number , but the first character should be any number from 1-9 and the second character should be any number from 0-9.
  • It should be zero or one white space character.
  • The next four characters should be any number from 0-9.
  • The last character should be any number from 1-9.

Valid Format – A2096457

Invalid Format – A209645704 (contains more than eight character)

                          209645704(contains no upper case)

Let us see how to configure the validate rule for passport numbers in Pega.

Configuration :

Step 1

Create castype called Validation and enter the step as mentioned below,

Step 2 

Add the required property . Here passport number is added as text property.

Step 3 :

Open the created property Passport number from app explorer . And in the advanced tab , the use validate field will be available . we need to create our custom edit validate rule.

Step 4 :

Create custom edit validate rule called PassportValidtion and configured it as mentioned below,

Let us also explain the regular expression used for passport number

“^[A-PR-WYa-pr-wy][1-9]\\d\\s?\\d{4}[1-9]$”

 Where,

  • ^ represents the starting of a string.
  •  [A-PR-WYa-pr-wy] represents the string that should be starts with A-Z excluding Q,X and Z.
  •  [1-9] represents the second character should be any number from 1-9. 
  • \\d represents the third character sho;ud be any number from 0-9.
  • \\s? represents the string should be zero or one white space character
  • \\d{4} represents the next four characters should be any number from 0-9
  • [1-9] represents the last character should be any number from 1-9.
  • $ represents the ending of the string.

Save all the rules.

Hurray!!! The implementation part is done .

Output Images :

Let us run the use case and verify our work.

Case 1Let us run the case with numeric value, it will show the error as it contains the invalid format .

Case 2 – Let us check with a positive case , we have entered the correct passport which meets all conditions. So no errors were found.

Let us also verify the clipboard page .

Youtube Video: