- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2015 12:27 AM
Hi,
How to hide the form sections and tab using client script?
I was trying the below client script with the reference of http://www.servicenowguru.com/scripting/client-scripts-scripting/showhide-form-section/
It was not working, hope it was working fine in Eureka and we are in fuji now and it's not working in fuji, i tested in demo also, the below script not working
function onLoad() {
//Hide the section
var section = $$('span[tab_caption_raw="Questions"]')[0].select('span[id*=section.]')[0];
section.hide();
alert(section);
//Hide the tab
$$('.tab_caption_text').each(function(caption) {
if(caption.innerHTML == 'Questions'){
caption.up('.tab_header').hide();
}
});
}
Could any one please help on this?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2015 01:01 AM
I just tried the below script in Fuji, i can hide the section.
function onLoad() {
var sections = g_form.getSections();
sections[4].style.display = 'none';
}
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2016 10:19 AM
This is a more appropriate answer to me since it uses ServiceNow's client-side API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2017 04:18 AM
Hi Mohamed,
Can you also let me know, how to make the all the fields of a particular section read only ?
Regards,
Sumana

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2018 10:47 PM
hi, I have tried this and its working well.
var value = g_form.getValue('u_problem_status');
if(value == 3)
{
g_form.setSectionDisplay('problem_investigationteam',true); // here my section name was like "Problem Investigation Team" so for firstspace use "_" rest no space and all chracters in smallcase.
}
else
{
g_form.setSectionDisplay('problem_investigationteam',false);
}