How to hide the first form section that is showing

davilu
Mega Sage

Our team has a requirement to hide the first form section aka the form section that shows onload.  When we use 

var sections = g_form.getSectionNames();
alert(sections.toString());

that returns all the form sections that appear in tabs on the form, but does NOT include the section that shows on the screen (ticket_details): 

davilu_1-1729716607067.png

davilu_2-1729716643037.png

We noticed that there is another method --

var sections = g_form.getSections(); 
alert(sections);
	

But when we load the page, the alert shows as an array of HTML Objects:

davilu_3-1729716844829.png

Notably there are 5 objects in the array instead of 4 from above, so we're hopeful that this could be our answer, but how can we get the names of each Section instead of showing the [object HTML SpanElement]?

 

1 ACCEPTED SOLUTION

Moin Kazi
Kilo Sage
Kilo Sage

Hi @davilu ,

 

Typically, in every table form, the first section is named after the table. You can verify this by checking the form layout.

Refer to the image below for the incident:

MoinKazi_0-1729748075888.png

 

However, I don't believe the first section can be hidden through a script, as it is generated by ServiceNow by default when the table is created.

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you found my response **helpful**, I’d appreciate it if you could take a moment to select **"Accept as Solution"** and **"Helpful"** Your support not only benefits me but also enriches the community.

 

Thank you!
Moin Kazi

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View solution in original post

3 REPLIES 3

Murthy Ch
Giga Sage

@davilu 

I believe you cannot hide that section using SN methods because it is created default by table creation.

The first section name will be the name which is displaying above the form number.

 

 

Thanks,
Murthy

Moin Kazi
Kilo Sage
Kilo Sage

Hi @davilu ,

 

Typically, in every table form, the first section is named after the table. You can verify this by checking the form layout.

Refer to the image below for the incident:

MoinKazi_0-1729748075888.png

 

However, I don't believe the first section can be hidden through a script, as it is generated by ServiceNow by default when the table is created.

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you found my response **helpful**, I’d appreciate it if you could take a moment to select **"Accept as Solution"** and **"Helpful"** Your support not only benefits me but also enriches the community.

 

Thank you!
Moin Kazi

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thank you, I think you're right!