Add a new menu item in ServiceNow’s header profile dropdown

This blog was originally published by Fruition Partners. Since then, Fruition Partners has become the ServiceNow practice within DXC Technology.

One of the strengths of ServiceNow is its flexibility and the customization capability it offers. In this Tips & Tricks article you will learn one of the many ways ServiceNow can be adapted to your user needs.

Imagine the following situation:
You would like to add a new menu item in the profile dropdown which is in the header (for example to add a toggle switch between the normal interface and the service portal/CMS).

Add a new menu item ServiceNow

The idea behind this is to tailor the navigation options to make it faster for your users to access what they need. This can be achieved by implementing a global UI script with the following code in it:

var addItem = ($j(“#custom_menu_item_1”).length == 0);
if (g_user.hasRoles() && addItem) {
//Replace ‘onclick’ by ‘href’ with the suffix of the portal
var menuItem = “<li><a id=’custom_menu_item_1′ onclick=’alert(\”Will switch to
portal\”)’>” + getMessage(“Switch to Portal”) + “</a></li>”;
var menuList =$j(“ul.dropdown-menu”);
if(menuList.length > 0){
//Uncomment for debugging

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: