Hide tab on a specific state of the form

Alessia Russo
Tera Expert

Hi everybody! I would like to hide some custom tab on my task form until it reaches some states, and after make it appear on the form. Is there a way without script for do that? Or it is possible anyway? If it's possible only with script, could somebody tell me which one should I use?

Thanks

1 ACCEPTED SOLUTION

benn23
ServiceNow Employee
ServiceNow Employee

Ahh, I see.  You're actually updating the record which is re-loading the form.  Your client script is not set up to run on load (2nd line of client script).  If you need this to run on form load, comment out lines 2-4.  

View solution in original post

15 REPLIES 15

Community Alums
Not applicable

Hi @Alessia Russo ,

 Without Scripting not possible!!

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);

 

  }

 

}

Hi @Community Alums could you explain me better the script pls? 

// var sections = g_form.getSectionNames();

 

  // alert(sections);

why this two are in comment?

if (g_form.isNewRecord())

here I should put in which state I want the tab to be hide or show?
thanks

 

Community Alums
Not applicable

@Alessia Russo ,

You can uncomment with the name of the section.

for //alert(sections); it's to check if the script is processing till here or not.

 

@Community Alums I've tried but it didn't work, so I try this way:

scrip1.png

script2.png

  but everytime the task state changes in 127 it didn't hide