Create a popup message upon login

jcpasia
Kilo Contributor

Hi,

I would like to know if anyone know the step by step procedure on how I can create a login popup message from scratch?

I wanted the users to agree to our "Terms and Conditions" upon logging in the instance and store their responses in ServiceNow. 

 

I found some articles from SNGuru although it requires downloading a dialog which is no longer available.

 

Thank you in advance for the feedback!

1 ACCEPTED SOLUTION

Willem
Giga Sage
Giga Sage

You can save the result either in a table or for example as a user preference. I modified the ServiceNow Guru script below:

function termsOK() {
    //Gets called if the 'OK' dialog button is clicked
    //Make sure terms have been accepted
    var terms = gel('accept_terms').value;
    if (terms != 'true') {
        //If terms are false stop submission
        alert('Please accept the terms and conditions to continue your order.');
        return false;
    }
    //If accept checkbox is true do this...
    GlideDialogWindow.get().destroy(); //Close the dialog window
    if (!getPreference("user_accepted")) {
        setPreference("user_accepted", "true")
    }
}

function termsCancel() {
    //Redirect gets called if the 'Cancel' dialog button is clicked
    if ($('cancel_url').value != 'null') {
        window.location = $('cancel_url').value;
    }
    else {
        window.location = 'home.do'; //Redirect to default homepage
    }
}

View solution in original post

18 REPLIES 18

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Earlier this week there was a similar topic on this. See:

https://community.servicenow.com/community?id=community_question&sys_id=efd216c2dbba10d09e691ea66896...

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Thanks Mark! We were still working on a solution. Not sure why it is marked correct already.

But I think it is working now. If you have time, can you see if you have any input on it?

https://community.servicenow.com/community?id=community_article&sys_id=ca3f3c47db7edc504aa5d9d968961...

Willem
Giga Sage
Giga Sage

Yes, we were working on it. I think I have it working now and wrote an article about it. If you have any additions, feel free to add:

https://community.servicenow.com/community?id=community_article&sys_id=ca3f3c47db7edc504aa5d9d968961...

jcpasia
Kilo Contributor

Hi @Willem ,

 

Thank you for information! May I know where in the scripts should I put the table to store their responses?