Pega Edit validate and Edit Input

Two rule types with almost the same name cause a lot of confusion: Edit Input and Edit Validate. Both belong to the Property category and both are small Java routines, but they do different jobs.

Edit Input (Rule-Edit-Input)

An Edit Input rule converts what the user typed into the form Pega stores. It is a conversion facility. It does not say whether the value is right or wrong, it just reshapes it.

Examples: turn " ramesh " into RAMESH, strip the dashes from a phone number, or change 25/12/2026 into the stored date format.

Edit Validate (Rule-Edit-Validate)

An Edit Validate rule tests whether a value is acceptable. It is a Java routine that returns true or false, and when it returns false Pega adds an error message to the property. Use it where a plain data type or a required flag is not enough.

Examples: a National ID checksum, a bank sort code format, or a rule that a number must be a multiple of 5.

Side by side

Edit InputEdit Validate
PurposeConvert or clean the entered valueCheck that the value is valid
ResultA changed valuePass or fail with a message
RunsWhen the value is enteredWhen the value is validated, for example through a Validate rule or the Property-Validate method
ExampleTrim and upper-case a codeReject an invalid sort code

A worked example

A bank captures a sort code such as 12-34-56 in a Pega form.

  1. An Edit Input rule removes spaces and dashes, so 12 34-56 becomes 123456 before it is stored.
  2. An Edit Validate rule then checks that the result has exactly six digits and that the first two are a known bank prefix. If not, the user sees "Enter a valid sort code".

Together they give clean data and clear errors. Attach both to the same property so every form using it behaves the same way.

Tips

  • Keep the Java short and side-effect free. These routines run often.
  • Prefer built-in property types, formats and "required" first. Write an Edit Validate only when they cannot express the rule.
  • Test with blank, too short, too long and unexpected-character inputs.

Related: Client and server side validation and the Validate label.

No comments:

Post a Comment