DoD Warning Banner
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2015 08:20 AM
Hello everyone. I am a little new to this, so please excuse my inexperience.
I am trying to implement a DoD warning banner for my Service Now application. I need the warning to be a pop up window when they hit the log in screen. It should have two buttons, "OK" which will allow them to log in and "Cancel" which will redirect them to a page of my choosing. I am not sure where to start on this. Any help would be greatly appreciated.
Thanks,
Mike
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2015 08:24 AM
Hi Michael,
Its been a while since I have seen one of those! I have found this tutorial by Mark Stanger helps when doing a pop up like that. The main difference is that instead of opening the dialog in an onLoad client script, you will likely need to display it in a Global UI Script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2015 08:29 AM
You could try something like this in a global ui script:
CustomEvent.observe('user.login', addConfirmPage);
function addConfirmPage() {
var msg = 'Show this message';
if (confirm(msg)) {
$('gsft_main').src = 'landing.do'
}
else {
$('gsft_main').src = 'custom_page.do'
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2015 09:40 AM
That works great, but I have run into a little problem. Since the user logs in before the banner appears, I want the "Cancel" button to log them out and send them back to the login page. I have used the below code, but it just sends them back and they get the banner again which allows them to click "OK" and continue. How do I log them out completely if they hit "Cancel"?
Thanks in advance for your help.
CustomEvent.observe('user.login', addConfirmPage);
function addConfirmPage() {
var msg = 'Show this message';
if (confirm(msg)) {
$('gsft_main').src = 'home.do';
}
else {
$('gsft_main').src = 'logout_redirect.do?sysparm_goto_url=<<my site>>/login.do';
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2015 10:05 AM
To log them out try:
$('gsft_main').src = 'logout.do';