Hiding sections/tab on incident form under certain conditions

sonita
Giga Guru

On the incident form , there are the following sections:

incident

notes

related records,

closure information

External

What I'm trying to accomplish is to hide the external tab when the form loads , and it should only be shown when the 'Escalated To' filed is showing certain values. The 'Escalated To'   field itself is only shown when the state changes to Escalated

find_real_file.png

this is what I did but doesn't work:

on change client script:

find_real_file.png

Any ideas?

1 ACCEPTED SOLUTION

User179407
Mega Guru

Section name looks incorrect, get the correct section name using alert (below sample script)



function onLoad() {


  // var sections = g_form.getSectionNames();


  // alert(sections);



  if (g_form.isNewRecord()) {


  g_form.setSectionDisplay('external_analysis', false);


  }


  else{


  g_form.setSectionDisplay('external_analysis', true);


  }


}



Suraj Chauhan


View solution in original post

4 REPLIES 4

User179407
Mega Guru

Section name looks incorrect, get the correct section name using alert (below sample script)



function onLoad() {


  // var sections = g_form.getSectionNames();


  // alert(sections);



  if (g_form.isNewRecord()) {


  g_form.setSectionDisplay('external_analysis', false);


  }


  else{


  g_form.setSectionDisplay('external_analysis', true);


  }


}



Suraj Chauhan


Thank you both Suraj Chauhan And Michael Ritchie ! very helpful



Thanks, I appreciate your help — I was able to adapt this code successfully for my scenario.

Michael Ritchie
ServiceNow Employee
ServiceNow Employee

Please see this post for more details.   The setSectionDisplay is expecting the name of the section not sections[4]:


Show/Hide Form Section by Name - ServiceNow Guru