Display ticket number in title bar in browser window

chaider
Kilo Explorer

Has anybody done anything with showing the ticket number in the title bar in the browser window?

1 ACCEPTED SOLUTION

Mark Stanger
Giga Sage

I think this will work for you. You can set up a UI Script under the 'System UI' application with the script below. The UI Script will have to have the 'Global' checkbox checked. This script sets the number and short description in the title if those elements are found on the form. If they aren't found, then a standard title is used.



addLoadEvent(setTitle);
function setTitle(){
try{
var num = g_form.getValue("number");
var sd = g_form.getValue("short_description");
}catch(e){
//alert('Error getting title info.');
}
if(num && sd){
top.document.title = num + ' - ' + sd;
}
else{
top.document.title='Service-now.com - IT Service Management Suite';
}
}


View solution in original post

7 REPLIES 7

Mark Stanger
Giga Sage

I think this will work for you. You can set up a UI Script under the 'System UI' application with the script below. The UI Script will have to have the 'Global' checkbox checked. This script sets the number and short description in the title if those elements are found on the form. If they aren't found, then a standard title is used.



addLoadEvent(setTitle);
function setTitle(){
try{
var num = g_form.getValue("number");
var sd = g_form.getValue("short_description");
}catch(e){
//alert('Error getting title info.');
}
if(num && sd){
top.document.title = num + ' - ' + sd;
}
else{
top.document.title='Service-now.com - IT Service Management Suite';
}
}


This doesn't work in "Fuji" - editor throws an error for line 9 when trying to save the script ("...Missing ) for condition...").


The code example has changed the 'ampersand' character to HTML.   You need to substitute where it says && with two ampersand characters.


Hi Peter,



Thanks for that hint, works perfect now - although I should have recognize this by myself



Best regards


Stefan