E
very once in a while I come across some script functions that might be useful given the right requirement. This article is one of those cases. In the post below I’ll show you how you can leverage some built-in client-side functions to show and hide the navigation and header frames in ServiceNow.
Navigation Frame
The navigation frame can be hidden, shown, or toggled using the following functions…
//Hide the left nav
hideNav();
//Show the left nav
showNav();
//Toggle the left nav
toggleNav();
hideNav();
//Show the left nav
showNav();
//Toggle the left nav
toggleNav();
Here’s an example global UI script that you could use to hide the left nav from end-users
‘HideLeftNav’ UI Script
Name: ‘HideLeftNav’
Global: true
Description: Hide the left nav for end users
Script:
Name: ‘HideLeftNav’
Global: true
Description: Hide the left nav for end users
Script:
addLoadEvent(hideLeftNav);
function hideLeftNav(){
try{
//If the user has no roles
if(!g_user.hasRoles()){
//Hide the left nav
hideNav();
//Hide the toggle image (optional)
//$('navToggleImage').hide();
}
}catch(e){}
}
function hideLeftNav(){
try{
//If the user has no roles
if(!g_user.hasRoles()){
//Hide the left nav
hideNav();
//Hide the toggle image (optional)
//$('navToggleImage').hide();
}
}catch(e){}
}
Header/Banner Frame
The banner doesn’t have as many functions available to it, but you can still toggle the banner like this…
//Toggle the header/banner
toggleBanner();
toggleBanner();
Would there be a way to hide the bottom frame via script? I’ve had several individuals who somehow activated the bottom frame without realizing, but did not drag it out to make its contents visible.
This caused links clicked in lists/nav windows to load in the hidden frame.
Thanks in advance!
Hi Mark,
These functions doesn’t work as expected in ServiceNow New UI. Is there any other method which can be used to hide header and navigator for ServiceNow new UI?
Thanks