How to implement custom validation rules in PEGA?
I'm trying to create a custom validation rule for email format validation in my case type. I've looked at the documentation but I'm still confused about the best approach.
Here's what I want to achieve:
- Validate email format on a property
- Show custom error message if invalid
- Apply this validation across multiple case types
I've tried using the built-in email format validation, but I need more specific validation rules for our business requirements.
Any guidance would be greatly appreciated!
2 Replies
Mike Rodriguez
Senior Architect1 day agoGreat question! For custom email validation in PEGA, you have a few options:
Option 1: Edit Validate Rule
Create an Edit Validate rule with a custom Java function or regex pattern:
@IsValidEmail(.EmailProperty)
Option 2: Custom Function
You can create a custom function in a library rule and call it from your validation.
I'd recommend Option 1 for most cases as it's more maintainable.
Jennifer Liu
Lead Developer18 hours agoBuilding on Mike's answer, here's a complete example:
- Create Edit Validate rule:
ValidateEmail
- Set the condition to check email format
- Add custom error message
- Reference this rule in your case type properties
This approach ensures consistency across all your case types.