- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
"Questionnaire Information" and "Service Provider Information" are two sections. I want to hide them if there are no visible fields under them. Is it possible to hide them dynamically?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
try this once
add your correct section name and field names within those sections
Section name is name of section in lower case and space replaced with underscore
function toggleSection(sectionName, fields) {
var showSection = false;
for (var i = 0; i < fields.length; i++) {
if (g_form.isVisible(fields[i])) {
showSection = true;
break;
}
}
g_form.setSectionDisplay(sectionName, showSection);
}
function onLoad() {
toggleSection('questionnaire_information', ['field1', 'field2', 'field3']);
toggleSection('service_provider_information', ['field4', 'field5']);
}
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
ahoy @Jessica1307,
it might be doable by an onLoad client script, could you share a screenshot to better understand what you want to (dinamically) hide?
Where the rules are real, you'll find me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@GlideFather
For example, there are "name" and "title" fields belong to "Service Provider Information" section, I want to show this section at least one field display on the form. Otherwise this section should not be displayed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
screenshot please ;))
Where the rules are real, you'll find me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@GlideFather ,
Screenshot is below, Service Provider Information is folded up, there is no information. Can it not be displayed?