Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Hiding tabs on Change form until a certain Category is selected.

Lee Kraus2
Tera Guru

Hello,

 

I'm trying to hide a tab (one I created) on our Change form so that it only shows up when a specific category is selected. I found what I think is a close example was from this Community question but I'm not sure I'm actually that close.

 

https://community.servicenow.com/community?id=community_question&sys_id=75397775db12f380f7fca851ca961979

 

This was for hiding the tab unless a specific Class what selected, and I don't know how to change the script in the example to work for my situation. I feel I'm close, I just need a little help, which would be greatly appreciated.

 

Thank you!

1 ACCEPTED SOLUTION

Muhammad Khan
Mega Sage

Hi Lee,

 

Try creating a UI Policy as follows;

find_real_file.png

find_real_file.png

Modify it as per your requirement.

 

Hopefully, this will resolve your query.

View solution in original post

5 REPLIES 5

Muhammad Khan
Mega Sage

Hi Lee,

 

Try creating a UI Policy as follows;

find_real_file.png

find_real_file.png

Modify it as per your requirement.

 

Hopefully, this will resolve your query.

Lee Kraus2
Tera Guru

Thank you for the reply Muhammad, but I did this and it didn't seem to work. I'll share some screenshots of what I did to clarify what I'm looking for.

find_real_file.png

 

find_real_file.png

 

find_real_file.png

 

I'm just looking to get that tab to show up only when I select the Category: Security: Firewall, and it shows up still for all Categories. 

 

I might have the name I need to put in there wrong, so any clarification would be helpful. Thank you again for replying, I look forward to your answer to this new update. 

Section name should be like firewall_ports. Below is the reference for above assumption of your section name.

find_real_file.png

To ensure this name,  open any existing record in which this tab/section is visible, then open the console in you browser and type g_form.getSectionsNames()

See the below image for reference.

find_real_file.png

When you find the actual backend name then use that name in g_form.setSectionDisplay()

Lee Kraus2
Tera Guru

Muhammad, thank you for the assistance. That was the correct name, and now I have this little bit of knowledge for next time something like this comes up.

For whatever reason, the Execute if True and Execute if False were backwards so I just flipped them and now my tab only appears when I'm in the correct category. 

 

Again, thank you sir!