…thoughts on ServiceNow and digital transformation

Post

Simple solution for terms and conditions upon SSO login – ServiceNow Portal


Many public organizations require a “terms and conditions” message to be displayed in the portal (Employee Center, Service Portal, etc) when a user logs in. This is a very simple solution that uses a javascript confirm box in the client script of a custom widget. This widget is inserted into the login page. Note that this solution is only useful when SSO is used, since the message is displayed before the user actually logs in.

The end result is a message like the below which is displayed each time the user logs in

1. Create a widget. Make the widget public. Put the below in the Client Script:

api.controller = function() {

    /* widget controller */


    var c = this;
    showMessage();

    function showMessage() {

        var rules = 'Here are the rules you must follow\n\nIf you do not follow the rules we will find you.';

        if (confirm(rules)) {
            //if user clicks OK let them continue
        } else {
            //if user clicks Cancel log them out
            window.location.assign('/external_logout_complete.do');

        }

    }

};

2. Put the new widget in the login page for your portal. If this login page is used by several portals and you only need the message on a single portal, you can create a new login page, make the new page public and then add the new widget to the page. Then set the new page as your login page for the portal.