Skip to main content
LinkedIn
Copied!

Table of Contents

Extending postal code validation to other countries

Pega Government Platform includes an edit validate rule that you can use in flow action rules to verify if the postal codes that users enter have the correct format. By default, the rule includes validation for postal codes for the United States, India, Canada, and the United Kingdom. Enable the tools that validate postal codes for more countries by extending the rule to cover other countries that you define in your application, for example, Canada.

  1. In Dev Studio, search for and select the PostalCodeFormat edit validate rule.

  2. Include strings for other countries by editing the java source. The following example demonstrates the string for Canada:

    String canZIP= "^[ABCEGHJKLMNPRSTVXY]\\d[ABCEGHJKLMNPRSTVWXYZ]( )?\\d[ABCEGHJKLMNPRSTVWXYZ]\\d$"; if(CountryCode.equals("CAN")) { p = java.util.regex.Pattern.compile(canZIP);

    m = p.matcher(theValue); isvalidZIP = m.matches(); if((isvalidZIP == false) ){ return false; } }

Suggest Edit
Did you find this content helpful?

Have a question? Get answers now.

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

Ready to crush complexity?

Experience the benefits of Pega Community when you log in.

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

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us