Custom Code, ServiceNow CMS

Create Custom Navigation Blocks

Everyone has a top/primary navigation set of links on their site. In ServiceNow CMS it’s pretty easy to just use one of the out-of-box headers and utilize a navigation menu. However, the challenge comes when you want something that isn’t one of the pre-defined ServiceNow “types” (dropdown, horizontal, vertical, etc.)

For instance, what if you wanted to create something like this on your home page as sort of a “featured links” section:

Sure, you could just hard-code it (dynamic block or HTML block), but then how easy will it be for a non-coder to keep it updated?

What if you wanted to have the menu serve up different items based on roles?

What if you needed it to be responsive and render differently on different viewports?

The way that I’ve found around this is to utilize a combination of a Navigation Menu + Dynamic Block.

Check out this code:

Simple right? It then lets you keep your code in one place and your content in another so it can render beautifully but is simple to manage. Both good things in my book.

Anything to add?

Leave a Reply