Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

UI Policy not hiding fields based on country selection in form

WanRedzuan
Kilo Contributor

Hi Community,
I’m trying to create a form where selecting a specific country should display only the related project checkbox fields. Here’s what I’ve done so far:

  • Created a UI Policy to hide all project fields when no country is selected.
  • Added conditions so that when Indonesia is selected, only Indonesian project fields appear, and similarly for Malaysia.

Issue:
Despite setting these conditions, when I select a country, all project checkboxes are displayed instead of only the relevant ones.

What I expected:

  • If no country is selected → all project fields hidden.
  • If Indonesia selected → only Indonesian project fields visible.
  • If Malaysia selected → only Malaysian project fields visible.

What actually happens:

  • All project fields remain visible regardless of country selection.

Question:

  • Am I missing something in the UI Policy configuration?
  • Do I need to use UI Policy Actions or Client Scripts for this scenario?
  • Any best practices for conditional visibility based on field selection?
2 REPLIES 2

Deepak Shaerma
Kilo Sage
Kilo Sage

Hi @WanRedzuan 

First please remove the policy that created for Hiding all fields when country is empty. Mostly it is causing the conflict.

 

Step 1: Configure the "Indonesia" Policy

  1. Condition: Country is Indonesia.

  2. Reverse if false: Checked (True).

  3. UI Policy Actions:

    • Add all Indonesia project fields -> Visible: True.

    • (Do not add the Malaysia fields here).

 

Step 2: Configure the "Malaysia" Policy

  1. Condition: Country is Malaysia.

  2. Reverse if false: Checked (True).

  3. UI Policy Actions:

    • Add all Malaysia project fields -> Visible: True

Happy to help! If this resolved your issue, kindly mark it as the correct answer and Helpful 👍and close the thread 🔒 so others can benefit too.
Warm Regards,
Deepak Sharma
Community Rising Star 2025

prajaktajga
Tera Expert

Hello @WanRedzuan ,

 

Global UI Policy to Hide All Project Fields
UI Policy: Runs when country is empty
 
country is empty
UI Policy Actions
For every project field, add an action:
 
Field                Visible Mandatory
Country Fields        false false
Country Fields        false false
  Make sure Reverse if false is checked.
 
country = Indonesia
UI Policy Actions:
 
Field      Visible
project_a_indo true
project_b_indo true
 
Same you can follow for the other country as well which you want to include