- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2017 05:21 PM
Geneva Patch 6. Using item designer with catalog client scripts
Have a catalog item consisting of 2 sections. Need to hide one of the sections. It is labelled 'Deploy and Recovery'
I have tried using the following in a catalogue client script.
g_form.setSectionDisplay("deploy_andrecovery", false);
This causes the catalog client script to not execute. Commenting it out ensure the script executes correctly
In the interim I am hiding all the variables in the section. The problem with this is that it leaves the section label (Deploy and Recovery) visible on the form.
I do not have much experience in debugging client scripts & until now how not done much work with catalog client scripts.
Appreciate if anyone can confirm that g_form.setSectionDisplay works in a catalog client script and any recommendations on how to hide a section on a catalog item
thanks,
Steve
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2017 08:09 PM
Sections and containers are different. The form tabs that you see on a table (incident.change,etc) are sections. The section like partition that you see on a service catalog is either a container, variable set or a label type field. Verify what is the type of field by right clicking and opening it's definition.
You should be able to hide them using g_form.setDisplay('name',false);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2017 05:43 PM
can you try like below an '_' was missing.
g_form.setSectionDisplay("deploy_and_recovery", false);
below link might be helpful
https://www.servicenowguru.com/scripting/client-scripts-scripting/showhide-form-section/
p.s : I am not exactly sure if hiding sections work in the service catalog.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2017 05:50 PM
Hi Nish,
I don't think naming convension of section is wrong,
setSectionDisplay
boolean setSectionDisplay(sectionName, display)
- Parameters:
- sectionName - name of the section to be shown or hidden. The section name is lower case with an underscore replacing the first space in the name, and with the remaining spaces being removed, for example "Section Four is Here" becomes "section_fourishere". Other non-alphanumeric characters, such as ampersand (&), are removed. Section names can be found by using the getSectionNames method.
- display - set true to show, false to hide.
- Returns:
- Boolean - true if successful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2017 05:55 PM
Hello Stephen,
It works. Just tested on my G instance. Please refer below blog on how to debug client-side Erros.
Using Chrome to Debug Client Side Errors
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2017 07:01 PM
thanks
So added some alert statements into the catalog client script
It appears that the reason it is failing is there are no sections
var sections = g_form.getSections();
alert(sections.length);
sections.length is returning 0
this is on an onLoad catalog client script.
Will test with client script on a form with sections