- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2025 07:06 AM
Hi I am trying to hide a form container (I could be wrong, but I'm sure that's what its called 😁) based on the the value of the task type field. I was thinking of scripting this however I am able to see it on form designer & form builder but can't find any labels or sys IDs for it. How can i achieve this? Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2025 02:58 AM
are you comparing the correct field and correct value?
you should compare choice value and not choice label
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2025 07:51 AM
g_form.setSectionDisplay('closure_information', false);
If you're unsure on the section name, as it might differ, you can use your browser's devtools and the following script
g_tabs2Sections.tabNames
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2025 12:56 AM
Thanks Kieran, I'm guessing this should be done as a onLoad client script?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2025 04:38 AM
You can do this in either an onLoad client script or the script section of a UI policy. I tend to go with UI policies for anything that show/hides fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2025 07:57 AM
it's called form section
ServiceNow provides this OOTB method to show/hide form section
The function accepts form section name separated by underscore and lower case
i.e. Closure Information -> closure_information
g_form.setSectionDisplay('closure_information', false);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader