Blog

Dynamic Window Titles

There are probably four types of people who use browser window/tabs in ServiceNow:

  1. Focused - Use ServiceNow in one browser window.

  2. Multiple Instances - have more than one instance of ServiceNow open in their browser. For example, have DEV and TEST instances open at the same time to debug.

  3. Multiple Browsers - have multiple browsers installed, like Internet Explorer, Mozilla Firefox, and Google Chrome installed. They open up ServiceNow in all three browsers and can now do three things at once!

  4. Multiple Tabs - if you hold the CTRL key down and click links in ServiceNow they open up in a new tab. You can then have multiple tabs open at once.

I often use multiple tabs and have a lot of tabs open at the same time.  The trouble with this is that all the tabs look the same and my browser might look like this:

Tab Chaos

To solve this issue, I have made a version of a Dynamic Window title, which is based on these two blog posts

  • http://wiki.servicenow.com/index.php?title=Display_Task_Number_as_Window_Title

  • https://community.servicenow.com/people/jim.coyne/blog/2013/04/30/2391

Here is the script I use:

UI Script: Dynamic Window Title

Active: true
Global: true
Description: Dynamic Window Title
Script:
addLoadEvent(setTitle);
function setTitle(){
//Set your Instance Name Here (DEV, QA, TST, STG, PRD, SBX)
var title = 'DEV ';
//Use this title instead if you set your property for product name
//var title = gs.getProperty('glide.product.name');
var windowName = top.window.name.toLowerCase();
switch (windowName) {
case "workflow":
title+="Workflow Editor";
break;
case "show_workflow_context":
title+= "Running Workflow(s)";
break;
case "super_bsm_map":
title += "BSM Map";
break;
case "super_schema":
title += "Schema Map";
break;
default:
try {
var name = g_form.getValue("name").replace("undefined","");
var number = g_form.getValue("number").replace("undefined","");
var shortDescription = g_form.getValue("short_description").replace("undefined","");
var lname = g_form.getValue("last_name").replace("undefined","");
var fname = g_form.getValue("first_name").replace("undefined","");
if ($("sysverb_query") != undefined) {
title += "Search";
} else if (g_form.isNewRecord()) {
title += "New Record";
} else if (name) {
title += name;
} else if (number && shortDescription) {
title += number + " - " + shortDescription;
} else if (number) {
title += number;
} else if (shortDescription) {
title += shortDescription;
} else if (lname) {
title += lname+', '+fname;
}
} catch(e) 

top.document.title = title;
}

Screenshots

Home Page

Incident Form

Change Form

User Form

Workflow Context

BSM Map