Show/Hide Form Sections

xiaix
Tera Guru

I read (in full) Show/Hide Form Section by Name - ServiceNow Guru

So... when using g_form.setSectionDisplay(), where do you define the section name????

What field on the sys_ui_section will go in the first parameter of g_form.setSectionDisplay() ???

I tried the following:

find_real_file.png

find_real_file.png

But it doesn't work.

find_real_file.png

1 ACCEPTED SOLUTION

This is not correct. Naming conevtion is as follows


"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."


View solution in original post

7 REPLIES 7

raycallan
Giga Guru

Hi David,



I have recently do this and based it on the caption (View name is blank)


My caption name is Escalation and my client script is g_form.setSectionDisplay('escalation', false);



try g_form.setSectionDisplay('hardware serial numbers and asset tags', false); or   g_form.setSectionDisplay('Hardware Serial Numbers and Asset Tags', false);



Note: it won't hide if it is the 1st section on the form and may not work if there are mandatory fields (to be verified)



Ray


Thanks for the reply.



I tried using the caption name, but it didn't work either.



Also, there are no mandatory fields within the section at all.



Yes, initially my "View Name" was blank too, but I went into the sys_ui_section table and manually added hardware_serial_numbers_and_asset_tags because I thought that was the trigger.   Nope.


This is not correct. Naming conevtion is as follows


"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."


Abhinay Erra
Giga Sage

Use this in the section name inside setSectionDisplay() function



g_form.setSectionDisplay('hardware_serialnumbersandassettags',false);