Showing the short description in the HTML Title

MorrisonC
Kilo Explorer

Firstly, sorry if this is posted in the wrong chat. Happy to have it routed correctly.

 

I am a little puzzled that the SNOW implementation team believes this can't be done; Surely not. I have used 8 other less capable ticket systems, and alas have found this functionality VERY useful. This being the ability to look at the browser history to find recent tickets by short description/title (cause come on, who remembers a 6 digit number for all tickets they have worked even in that day 😉 ). Is there really no way to put short description in the HTML title tag on the page view for the Helpdesk staff, also

 

The attached is what the SNOW implementation team could get to work, but that is only on the user end. The rest are how it appears viewing tickets are someone with a "backend" license to SNOW in the HTML title of the page.

2 REPLIES 2

yashkamde
Giga Sage

Hello @MorrisonC ,

 

As far as I know, if you are looking at standard forms (e.g. incident.do?sys_id=..), the browser title is controlled by the display value of the table or can be dynamically manipulated via a Client Script.

 

you can create an OnLoad Client Script on the table that runs in the backend.

function onLoad() {
    var title = g_form.getValue('number') + ' - ' + g_form.getValue('short_description');
    
    // Pushes it directly to the browser HTML title tag
    top.document.title = title;
}

 

If my response helped mark as helpful and accept the solution.

Ehab Pilloor
Giga Sage

Hi @MorrisonC,

 

Please refer this: https://servicenowguru.com/ui-scripts-system-ui/dynamic-browser-window-title-script/


Copy pasting contents below:

UI scripts in Service-now are one of those things that can be very useful but aren’t very well known.  They allow you to do a lot of client-side javascript manipulation of places in the form that you might not otherwise be able to get to.  One good example of this is setting the browser window title dynamically based off of the content of records being displayed.

 

 

 

By default, Service-now displays the same window title information all of the time no matter what you’re looking at within the application.  This isn’t normally an issue, but it can be frustrating if, like me, you work with multiple browser tabs open that all have something to do with Service-now.

 

You might just prefer to look at a different title every now and then :).  In my client’s case, they wanted to change the window title dynamically when they opened up a task ticket. They wanted to show the Number and Short description of the task being displayed. Otherwise, they wanted to show the default title. We accomplished this with the addition of a simple global UI script as outlined in the steps below…

1. Navigate to ‘System UI -> UI scripts’ and create a new UI script

2. Name the script ‘DynamicWindowTitle’ and check the ‘Global’ checkbox

3. Use the following script in your UI script

 
addLoadEvent(setTitle);
function setTitle(){
try{
var num = g_form.getValue('number');
var sd = g_form.getValue('short_description');
var nme = g_form.getValue('name');

//Check if viewing a KB article
if($('kb_view')){
num = $('permalink').href.split('sysparm_article=')[1];
sd = $$('.kb_article_header_short_description')[0].innerHTML;
}
}catch(e){
//alert('Error getting title info.');
}
if(num && sd){
top.document.title = num + ' - ' + sd;
}
else if(nme){
top.document.title = nme;
}
else{
top.document.title='Service-now.com - IT Service Management Suite';
}
}

 

If this response resolved your issue, please consider marking it as Helpful and accepting it as the Solution. Your feedback helps other ServiceNow Community members find reliable answers.

Kind Regards,

Ehab Pilloor