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/Banner Frames

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

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:

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){}
}

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