Most Recent

Blog Post

Pega and Country Picker Controls

Pega offers two country picker controls OOTB: Pick-Country and Pick-Country-i18n; with two differences: one in its appearance in the user interface (UI) and the other in the country codes underneath it.

Inspecting the HTML source for these two business rules will tell your the full story...

While the obvious choice between these standard pickers would be to implement the internationalized version Pick-Country-i18n over the simpler Pick-Country if you need the country names that appear in the dropdown menu to be translated into the user´s preferred language. This is actually adopting Java´s localization (L10n) class java.util.Locale as major benefit for the former control rather than just conceptual internationalization (i18n) common to modern software design.

The other slight difference (snag if you will) is that the Pick-Country will return 3-letter country codes. In contrast to the newer Pick-Country-i18n which returns 2-letters codes.

Remember: Pick-Country control returns ISO-3166 alpha-3 codes such as "GBR" when making the selection where as the internationalized version called Pick-Country-i18n returns ISO-3166 alpha-2 codes such as "GB" when making the selection.

Needless to say that the developer should map these to pyCountryCode property instead of some pyCountry, which would expect to hold a country by name.

Given that pre-existing (@baseclass) Field Value for Field Name (pyCountryCode) can be set as class key for certain properties, let´s examine the data model regarding countries and its codes a bit further in Pega...

CLASSPROPERTYTYPE AND COMMENTS
@baseclasspyCountryIdentifier
Data-Address-PostalpyCountryText
Data-pyCountryText
@baseclasspyCountryCodeText i.e. alpha-2 or alpha-3
Data-pyCountryNameText
Data-PartypyHomeCountryvalidates with "Class Key Value" through Rule-Obj-FieldValue pyCountry
Data-PartypyOtherCountryvalidates with "Class Key Value" through Rule-Obj-FieldValue pyCountry
Data-PartypyWorkCountryvalidates with "Class Key Value" through Rule-Obj-FieldValue pyCountry

Note: The last three properties validate by full English country name in order to safely support the i18n translations of full country names by the Field Value rules for Data-Party.pyCountry -- if you have certain Language Packs installed.

Conclusion: So, in practice you need to reuse pyCountryCode (or at the very least introduce your own Code property) in the data model in order to leverage either one of the available Pick-Country* controls in Pega. Do not mistake pyCountry for taking and accepting any 2- or 3-letter codes, since it gets overridden in Data-Party.

See: Wiki List of ISO-3166 Country Codes

Please take note when implementing proper internationalization on the Pega platform or you could run into error message like:

"The Field Value with key value(s) Data-Party-Operator/pyCountry/GB does not exist."

System Internal: The also exists a third country control named PromptCountryFieldValue, but I leave that to the reader ;-)

#StaySafe

PS. In at least Pega 8.4.2 we observe that triggering of pick-country-i18n is broken and does not function. So, any event handler you define won´t cause the action to execute; not even a Post value. This bug should get logged as SR and be fixed.

[Edgar] (3/4/2021 4:25:30 PM)

 

Twitter Feed

@edgarverburg

Bio

About Edgar

Edgar is a software engineer with experience in TIBCO Middleware and Pega Case Managemement. He holds a master's degree in Computer Science with a specialization in Data Visualization & Computer Graphics.

In his spare time Edgar reads SOS and Empire, mixes house music, blogs and writes film reviews or goes running.


Currently employed by SynTouch he is specifically looking for a PRPC project. Feel free to contact him for challenging assignments through LinkedIn.