Blog

More Top Navigation Buttons

Add buttons in the ServiceNow top navigator bar to link to other sites.

In this example, three buttons were added to the top navigator bar

Code

UI Script:
API Name: sne_top_menu
Application: Global
UI Type: Desktop
Global: true
Description: Additional Links for Top Navigation www.servicenowelite.com
Script:
function sne_top_menu () {
	if (typeof jQuery === 'function' && typeof top.$j === 'function') {
		jQuery(document).ready(function () {
			var top = window.top;
			if (typeof top.sne_top_menu != 'undefined') {
				return;
			}
			top.sne_top_menu = true;
			var widgetHtml;
			widgetHtml =
				'<div class="navpage-header-content">' +
				'<button data-placement="auto" class="btn btn-icon icon-home"' +
				' title="' + "Home" + '" data-original-title="Home" onclick="window.open(\'/home.do\', \'gsft_main\');">' +
				'<span class="sr-only">Home</span>' +
				'</button></div>' +
				'<div class="navpage-header-content">' +
				'<button data-placement="auto" class="btn btn-icon icon-global"' +
				' title="' + "Service Portal" + '" data-original-title="Service Portal" onclick="window.open(\'/sp\', \'_blank\');">' +
				'<span class="sr-only">Service Portal</span>' +
				'</button></div>' +
				'<div class="navpage-header-content">' +
				'<button data-placement="auto" class="btn btn-icon icon-book"' +
				' title="' + "Knowledge" + '" data-original-title="Knowledge" onclick="window.open(\'/$knowledge.do\', \'gsft_main\');">' +
				'<span class="sr-only">Knowledge</span>' +
				'</button></div>';
			top.$j('#sysparm_search').parents('div.navpage-header-content').first().after(widgetHtml);
		});
	}
}
sne_top_menu();