Make a Field Required for a Specific Country by Using Country Codes in the Expression

To make changes that apply to everyone in a specific country, you can make country-level customizations. For example, you want to make the Date of Birth field required for anyone in the UK adding or editing a contact. For all other countries, the field remains optional. Here's how you can make those changes using a country code in the expression.

Before you start

Create a Sandbox and Make It Active. Be sure to follow the steps to set up the sandbox for site-level changes and not country-specific changes.

Here's what to do

  1. Go to Navigator > Configuration > Sandboxes.
  2. Enter your sandbox.
  3. Go to and open the page where you want to make the country-level change. For example, to change the New Contact page, go to Me > Benefits > Before You Enroll. Then in the People to Cover section, click +Add.
  4. On the Settings and Actions menu, click Edit Pages.
  5. Confirm that the edit page header has Edit Layer: Site - SITE.
  6. On the Structure tab, select the field that you want to customize, such as Date of Birth.
  7. On the Confirm Shared Component Edit dialog box, click Edit.
  8. On the Source pane, click the Show the properties of... icon, such as Show the properties of inputDate or Show the properties of inputText.
  9. On the Component Properties dialog box, for the appropriate field, such as Required, select Expression Builder.
  10. On the Expression Editor dialog box, in the Type a value or expression field, enter the appropriate expression. Here's the expression to make the field required for people in the UK:
    #{row.bindings.DateOfBirth.hints.mandatory or (sessionScope.BEN_CountryCode eq 'UK' ? true : false)}
  11. Click OK.
  12. On the Component Properties dialog box, click Apply.
  13. Click OK.
  14. To render your changes, on the page, click Close.
  15. To verify your changes, on the Sandbox Mode: Edit menu, select Preview as if Published (Context: All).
  16. To publish your changes, on the <YourSandboxName> menu, select Publish.