Popup Message after logging in to instance

ah16
Mega Expert

Hi,

Can you please provide steps to create popup window with a message after logging in to instance?

Similar like this one:  https://www.servicenowguru.com/system-definition/login-terms-conditions-dialog/

 

Thanks,

Ashraf

 

1 ACCEPTED SOLUTION

I have added a check so it will not run on login page. And changed to session variable so it will trigger each new login:

addLoadEvent(function () {
    var session = gs.getSession();
    if (session.getClientData('popup_triggered')) {
        return;
    }
    if ((window.name !== 'gsft_main') || (window.parent.document.URL.indexOf("login.do") > -1)) {
        console.log("Prevent popup in this window or on this page.");
        return;
    }

    session.putClientData('popup_triggered', 'true');


    //Ensure that we call the dialog for the correct frame
    if (window.frameElement) {
        if (window.frameElement.id == 'gsft_main') {
            showTerms();
        }
    }
    else if (!window.frameElement) {
        if (!$('gsft_main')) {
            showTerms();
        }
    }
});

View solution in original post

21 REPLIES 21

This alert message is showing up on login page also and it got stuck 

Maybe, we can just redirect to a page after successful login instead of using this pop-up. Any ideas?

 

find_real_file.png

I have added a check so it will not run on login page. And changed to session variable so it will trigger each new login:

addLoadEvent(function () {
    var session = gs.getSession();
    if (session.getClientData('popup_triggered')) {
        return;
    }
    if ((window.name !== 'gsft_main') || (window.parent.document.URL.indexOf("login.do") > -1)) {
        console.log("Prevent popup in this window or on this page.");
        return;
    }

    session.putClientData('popup_triggered', 'true');


    //Ensure that we call the dialog for the correct frame
    if (window.frameElement) {
        if (window.frameElement.id == 'gsft_main') {
            showTerms();
        }
    }
    else if (!window.frameElement) {
        if (!$('gsft_main')) {
            showTerms();
        }
    }
});

jcpasia
Kilo Contributor

Hi @Willem ,

 

Does the dialog pops up onLoad of the login page? Or once the user has entered their credentials?

 

And is it possible to store the records of the users who agreed to the terms?

 

Thank you in advance!

Hi @jcpasia It is possible to Store. I will add it to the article. Thank you for suggesting