Tweaking your ServiceNow header using custom CSS

//Tweaking your ServiceNow header using custom CSS

Tweaking your ServiceNow header using custom CSS

UPDATE: Most of this customization can be accomplished through the use of system properties described here (transparent image, gradient background). Whenever possible, these properties should be used in place of the customization described below.
UPDATE 2: I’ve received several questions about the wiki documentation linked to above. I agree it’s confusing! We still do this customization all the time at Crossfuze Solutions for our clients using a couple of properties. The good news is that it’s nowhere near as confusing as it’s made out to be to add a simple background color and image to your instance header. Here are the steps we took to produce the following look in our company instance. Note that styling of the Banner bar and Logout button is no longer possible with the properties ServiceNow has made available.

Service-now.com custom header

1) Upload your background image (if desired) using the ‘System UI -> Images’ module
2) Create (or set) the ‘glide.banner.style’ system property with a value similar to this… background: #444444; background-image:url(‘triangles.pngx’);
3) Create (or set) the ‘css.banner.background.color’ system property with a value of transparent
4) Remove the product description (text that appears next to the header logo) by changing the ‘glide.product.name.style’ property to include ‘display:none’ like this… padding-bottom: 0px; padding-top: 0px; display:none;
5) Adjust the ‘glide.product.name’ property to reflect whatever you want to appear in the browser tab. We use ‘Crossfuze – ServiceNow Portal’

ServiceNow allows you to brand your ServiceNow instance by uploading any image to the primary company record in your instance.  The result of this branding is an instance showing your custom logo in the top-left corner of the screen on top of a plain white background.  This type of customization works great but some customers want to take this idea even further and really tweak the look of their header.  Maybe they want to add some links in the header or they want a custom background to better match their corporate branding.

Service-now.com custom header


It is possible to use custom CSS and HTML to completely customize the look of the header in your instance.  You do need to be careful when doing this that you don’t break something else in the process.  Any time you make a modification like this you’ll want to make sure that you test the modification thoroughly in all browsers used in your organization.  Below are the steps I took to produce the look in the image above.

1Navigate to ‘System UI – UI Scripts’ and create a new record.

2Give your UI Script a name and make sure that the ‘Global’ checkbox is checked.

3Paste the following code into the ‘Code’ field of the UI Script. Note that you can customize this code with your own custom HTML and CSS.

try{
   //Set the background CSS of the navigation header
   window.parent.$$('td.bannerRight','td.bannerLeft','td.bannerCenter','td.navpageTools').invoke('setStyle',{backgroundImage: 'url(/blueGreenGradient.jpgx)'});
   //Set the background CSS of the navigation header stripe directly below the logo
   window.parent.$$('tr.nav_header_stripe').invoke('setStyle',{backgroundImage: 'url(/yellowGradient-small.jpgx)'});
   //Set the background CSS of the navigation header stripe 'Logout' button
   window.parent.$$('button.nav_header_button').invoke('setStyle',{backgroundImage: 'url(/rustGradient-small.jpgx)'});

   //OPTIONAL:  Set html text in the banner for font styling, marquee, etc.
   window.parent.$('nav_header_text').innerHTML = '<marquee><strong>My custom scrolling banner</strong></marquee>';
}catch(e){}

–Note the ‘backgroundImage’ lines in the code above. These image names should match the names of images you upload to your ServiceNow instance. Optionally, you could use a standard background color in place of a background image if you wanted to.

4Navigate to ‘System UI -> Images’ and upload your background images. Make sure to name your images so that you can remember them and modify the above script accordingly. I went to http://tools.dynamicdrive.com/gradient/ and created some simple gradients to use. The only thing you’ll need to worry about is the size of your gradients. Because we’re repeating the image in our background using CSS, the gradient image really only needs to be about 5px wide. The height of the gradient image will depend on the height of your custom logo. For reference purposes, the best height to use with the default ServiceNow logo is 50px and the nav header stripe image should be 25px.

By | 2018-07-09T15:01:33-06:00 December 28th, 2009|Categories: System UI|Tags: , |32 Comments

About the Author:

32 Comments

  1. Torsten Brosow February 9, 2011 at 8:32 pm - Reply

    Hi Mark,

    Thank you for pointing this out.

    I have a customer requirement to set a banner image over the full width of the page. I tried to use your recommendation above but this didn’t do the job completely.

    I discovered the following issues.

    It does work if I have only a gradient image over the whole page but with this image (I add the link below) I stucked. Maybe there is another way to do it. ( To make Service-Now nicer 🙂 )

    https://picasaweb.google.com/lh/photo/Ib0fKFqJe9h

    • Mark Stanger February 10, 2011 at 1:52 am - Reply

      Thanks for the comment. Unfortunately, I’m not sure exactly how you could set that image up for your header. It might be possible, but would probably take a fair amount of experimentation. Unless the customer has a CSS/HTML expert on their end that can customize it, I would advise them to stick to a more standard header.

      • Torsten Brosow February 13, 2011 at 11:27 am - Reply

        Do you know if there are any restriction using browsers like IE V6,7 &8?

        Only with IE Version 9 the style code is working.

        • Mark Stanger February 14, 2011 at 12:52 am - Reply

          I’m running IE8 and it works there and I’m almost positive it works with IE7 as well. I can’t tell you for sure with IE6 though.

  2. Dan Berglin January 12, 2012 at 1:09 am - Reply

    Hi,
    I´ve done similar modifications to our banner.

    However, when you change the “nav_header_stripe”, you would also like to change the appearence of all list headers and form headers (css.base.color).

    Any tip on wheren you can add a to override that?

    Kind regards,
    Dan Berglin

  3. Dan Berglin January 12, 2012 at 7:09 am - Reply

    Hi Mark,
    I dont want to apply it through the header, I want to find the place where it could be added. I want to apply gradient (background-image) on the same stripes/list-headers/form-headers as the css.base.color property applies to. Can’t find any good place to add the custom css for it.

    Client script would be to much of a hack. It would also most probably flash from solid to gradient onLoad.

    Regards,
    Dan Berglin

    • Mark Stanger January 12, 2012 at 8:13 am - Reply

      Okay. I didn’t know you wanted to do a gradient there as well. I actually investigated this at one time but it wasn’t very simple to pull off at the time. I’ll take a look again and see if there’s a way. I’ll post here if I find anything.

  4. Kamal Mikhail August 7, 2012 at 2:01 am - Reply

    Thanks for this info. It works great in IE9+ or in Chrome/Firefox/Safari with one exception.
    On the login page for the instance, the CSS is not rendered but is displayed in plain text in the banner instead.. is there a way to stop this?
    Also, when the banner frame is minimised (using the arrow in the top right of the banner), the CSS text is again displayed in plain text which is unsightly..

    I note your update at the top of the page, I’ve tried to create the “css.banner.background.image” property, but it doesn’t seem to actually do anything.

    • Mark Stanger August 7, 2012 at 5:47 am - Reply

      ‘css.banner.background.image’ does work. You may be seeing a caching issue of some sort. Make sure that you remove the CSS from your company record in order to use the system property. As far as the login page and collapsing banner, there’s not a good way to work around that currently.

  5. Kamal Mikhail August 7, 2012 at 6:32 pm - Reply

    I must have the wrong syntax for the ‘css.banner.background.image’ value. I can’t get it to do anything even on a brand new instance.
    I decided to use the ‘css.banner.background.color’ property instead but that was also not working.

    Strangely, enabling the ‘CSS Theme support’ plugin seems to have resolved this, even without actually specifying any themes on the company record, so it may well have been a caching issue.. Either way, THANK YOU VERY MUCH!

  6. Ryan Cox September 26, 2012 at 12:06 pm - Reply

    Where you able to find a way to add gradient headers to form and buttons by chance?

    • Mark Stanger September 26, 2012 at 12:12 pm - Reply

      I haven’t been able to find a way to do that. It would probably have to be a client script or ui script hack if it could be done at all.

  7. Faizeal October 4, 2012 at 4:28 am - Reply

    Hi..How can we set the marquee in banner text?I’ve done it in header, but shown the tag once we log out the session…can any one help on this please???

    thanks…

    • Mark Stanger October 4, 2012 at 7:15 am - Reply

      ServiceNow has crippled the ability to do this with the security updates in Aspen. You’ll see the tags if you collapse the form header too. I’m not aware of any good way around it that doesn’t compromise security.

    • Mark Stanger October 12, 2012 at 7:14 am - Reply

      Good news! I think you were on this forum thread, but there’s a way to do this now. I’ve updated the example above to show you how.

      • Ryan Cox October 12, 2012 at 8:34 am - Reply

        This is great work. Do you think this can be used to edit other headers throught out the system? Particuarly I am looking at list headers. I want to use some more gradients.

        • Mark Stanger October 13, 2012 at 1:35 pm - Reply

          @Ryan, I tried this…again with this updated solution. While I did manage to get this working for form headers, lists, and buttons, I can’t get it to work for everything across the instance, and across different browsers consistently. Some things don’t work in IE, some things don’t work in popups, some things don’t work outside of the standard frames. Sometimes it’s a button, sometimes it’s a list header. I’m sure that eventually you could track down all of the different issues, but the result would likely be a massive hack. I think the better route would be to request this enhancement through ServiceNow. I’ve asked for this before but didn’t get much traction with the developers as a ServiceNow employee. Maybe you’ll have better luck as a customer.

  8. Mike August 30, 2013 at 1:47 pm - Reply

    I am really disappointed with the documentation at http://wiki.service-now.com/index.php?title=Modifying_the_Banner. I have spent hours trying to get this blasted thing to work to no avail. The solution you posted here with the UI Script is the only thing that works, but unfortunately we really need to do it the proper way with the style sheet. I have gone to “sys_properties.list” and added a property called “css.banner.background.image”. I have given it a value of “url(‘./images/Header.pngx’)” and nothing. The instructions are so unclear I even tried “css.banner.background.image value url url(‘./images/Header.pngx’)”. Disabled caching in the browser and reloaded… nothing. Then there is the section about “TD.bannerLeft,TD.bannerCenter,TD.bannerRight”… If this needs to be added to the style sheet somewhere it sure would be nice if the instructions spelled it out. I’m not even sure if this works on Berlin or Calgary at this point. If you could provide any insight into how to get this seemingly simple modification done I would certainly appreciate it. The wiki is no help.

    • Mark Stanger August 30, 2013 at 3:20 pm - Reply

      I agree. I’ve updated the top of the article to include simple instructions for producing the header background look. Give that a try and let me know how it goes.

      • Mike September 3, 2013 at 7:06 am - Reply

        glide.banner.style works just fine. Thanks for the update.

  9. stephanie June 11, 2014 at 1:05 am - Reply

    What about removing the search box on the top of the banner? Is there a way to do this?

    • Mark Stanger June 11, 2014 at 6:30 am - Reply

      Probably easiest just to go to the ‘Global Text Search’ module and disable it or adjust the roles that it is available to.

  10. Stephanie Brady June 11, 2014 at 5:30 pm - Reply

    Is there a way to move the search box to a different location within the banner? Thank you!

    • Mark Stanger June 11, 2014 at 5:34 pm - Reply

      It’s probably possible, but it would be a pretty major hack to get it done. For all intents and purposes, the answer is ‘no’. I certainly wouldn’t ever recommend it to a client of mine.

      What we do all of the time though is set up custom front-end interfaces for end users by using the ServiceNow CMS. That gives you all the flexibility in the world to customize the look and feel and we’ve actually made significant enhancements to the search capability in that interface. You can check out the Self-service/CMS product that my company, Crossfuze, offers here…

      http://www.crossfuze.com/solutions/turnkey-solutions

      Feel free to contact me if you’d like a demo of that enhanced self-service interface.

      • Stephanie June 11, 2014 at 6:02 pm - Reply

        I am working on a CMS solution; however, I wanted to change the SN banner in the interim. Is there a way to add external links to the banner, on the right side?

        • Mark Stanger June 11, 2014 at 6:10 pm - Reply

          No, there isn’t…at least not without an unadvisable hack. If you’re serious about CMS I think it would be well worth your time to let me give you a demo of the Crossfuze solution. We’ve taken a base CMS install down from 2-3 weeks to 10-15 minutes…all while giving you much more functionality and flexibility. You’ll struggle quite a bit with the standard ServiceNow CMS solution when we can supply something so much better in a matter of minutes.

  11. Isaac Torkelson October 14, 2014 at 9:10 pm - Reply

    Mark, I’ve looked at all your articles regarding CSS and style sheets and I can’t seem to find the resolution to my issue. I’ve recently upgraded our Sandbox instance to Eureka Patch 4 Hotfix 1 From Berlin to being the evaluations for implementing across all instance. I’ve now also upgraded our Development instance and have started to do the configuration work to accommodate to the changes and features. I really like UI14 but I’m having an issue with the difference between how a Form is presented in CMS versus the standard UI. It looks like after upgrading when using the standard UI the Form Header background was changed to Grey and the text to dark to match the new UI Theme which is perfect. However when clicking into a detail record through the CMS such as an incident or a requested item the form header is still the original blue that it has been while the text is shown as the dark UI14 color which used to be white. This makes the text and button icons hard to see for the average user if they don’t know they are there. I want the Forms to render in the CMS exactly like it does in the standard UI as far as the Form Header is concerned. Basically I want the grey form header bar in CMS just like what I have in the standard UI. I’ve checked over a bunch of different wiki and community articles and combed over the style sheets and looked all over but can’t seem to find where this is set or where I can control it. Any help you can provide would be great! Your articles are very good btw.

    • Mark Stanger October 14, 2014 at 9:39 pm - Reply

      Thanks Isaac. I’ve seen this issue reported a few times before and it seems to be a Eureka bug. The best information I’ve found on it comes from this community post…

      https://community.servicenow.com/thread/166914

      It sounds like the issue was fixed in Eureka patch 2 so your instance should be okay, but the link also discusses some ways to modify the doctype settings so you could try that. If that doesn’t work you’ll probably need to contact SN support. Please let me know what you find as I’m sure this won’t be the last time someone comes across this issue.

  12. Anna July 13, 2015 at 10:16 am - Reply

    For some reason, every background image I try just comes out tiled. Any way around this?

  13. Kevin July 8, 2016 at 9:33 am - Reply

    Mark,
    I know this is old but…..
    Anyway to make this occur based on the domain you chose in the domain picker – we are still on Eureka. Looking to highlight to our techs that they are in another domain – as an MSP we answer the phone and emails as our client in some instances and tey have different flows and forms in a domain sep. environment.

Leave A Comment