Please help with URL in Modal Popup issue.

Lisa Goldman
Kilo Sage

Hello,

When the form loads in the Service Portal, the following modal message pops up. The problem we are facing is that when we click on the 'SN Community' link, it takes us to a 'Page not found' error.

 

Popup Message

LisaGoldman_0-1705023378133.png

 

Error

LisaGoldman_1-1705023738405.png

 

Here is the code.  Could someone please help take a look?  Thank you!

 

function onLoad() {

   if (window) {

            var glideModal = new GlideModal("ui_page");

            var URL = 'https://www.servicenow.com/community/';

            glideModal.setTitle("Note");

            glideModal.setBackdropStatic(true);

            glideModal.render();

        } else {

            spModal.open({

        title: 'NOTE',

        message: getMessage('Test Popup') + '<br /> <br /><a href="' + URL + '" target="_blank">' + getMessage('SN Community'),

        buttons: [

            {label:'✔ ' + getMessage('Close'), cancel: true}

        ]

    });

        }

1 ACCEPTED SOLUTION

Lisa Goldman
Kilo Sage

Please discard this thread, as I have figured out what I did wrong.

The URL variable is defined inside the if (window) block, making it inaccessible outside that block.

Thank you

View solution in original post

1 REPLY 1

Lisa Goldman
Kilo Sage

Please discard this thread, as I have figured out what I did wrong.

The URL variable is defined inside the if (window) block, making it inaccessible outside that block.

Thank you