Form Section Hide/Show via Checkbox

Adam Kirk
Tera Contributor

I've been tasked with adding checkboxes to the standard Change Request form, to mimic an internal deployment document.  I would like to toggle the visibility of section names based on checkbox true/false status via UI Policy, but I am having no luck.  

 

1. Do the checkboxes refer to applications utilized by my company (e.g. Azure).  Do these checkboxes need to tie to the Applications table?

 

2. If not, and this can be resolved by UI Policy alone, then this is an example of what I've tried with no success.

 

 

3 REPLIES 3

CarlaP
Mega Contributor

Hey Adam, For hiding sections based on checkbox selections, UI Policies are definitely the way to go! Double-check your conditions and actions - maybe a typo or missing reference is causing the issue. 
If you're still experiencing issues with your UI Policy, consider taking a short break to refresh. Perhaps a quick Google search for how to defrost Samsung refrigerator can help clear your mind and provide a fresh perspective.

Ankur Bawiskar
Tera Patron
Tera Patron

@Adam Kirk 

where did you write this script? client script?

Did you debug by adding alert statements?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Moin Kazi
Kilo Sage
Kilo Sage

Hi @Adam Kirk 

 

In UI Policy, simply specify your condition under the 'When to apply' section, and in the script section, use the line below, replace 'resolution' with your section name.

 

g_form.setSectionDisplay('resolution',false);
 
See Images -
MoinKazi_0-1729359183427.png

 

 


 

 

Before UI Policy - 

MoinKazi_2-1729359183437.png

 

 

Output: After UI Policy Applied -

MoinKazi_3-1729359183438.png

 

 

Hope this help You.

 

Regards 

Moin