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

benn23
ServiceNow Employee
ServiceNow Employee

Try wrapping '127' in quotes (line 11)

@benn23 even like that it doesn't work

benn23
ServiceNow Employee
ServiceNow Employee

Use the alert to get the actual names of the sections.  You're using 'Diagnosis' but I believe section names are truly all lowercase (and spaces replaced with underscores).
var secs = g_form.getSectionNames();
alert(secs);
My guess is you will need to change yours to setSectionDisplay('diagnosis',false) (lowercase 'diagnosis')

@benn23 yeah I've tried with the lowercase name, because I see the actual name is 'diagnosis' but it doesn't work anyway

benn23
ServiceNow Employee
ServiceNow Employee

Couple more suggestions.
Add an alert inside your 'if' statement to validate that the conditions are met.  
Print off the alert that's throwing the section names... Should be an array of section names.  Can you share those here?