Pop up window on change of Category variable

Shwetha Nair
Giga Guru

Hi All,

 

I have a requirement to show a pop up window containing two links : Google :https://google.com , SN :https://servicenow.com  on user selecting values as Request Info. , general Inquiry in Category field in one of the Catalog Item . This popup will have a 'X' button & Done button to close the popup in either right side corners respectively. Please find attached for better understanding, expecting a result very close.

 

Thanks,

Shwetha 

1 ACCEPTED SOLUTION

Shwetha Nair
Giga Guru

Apparently, this is how I achieved it using just onchange client script as I found the UI page doesn't support in portal , also GlideDialogWindow was also not supporting in my instance. 

 

Script :

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }
    if (newValue == 'sysid' ) {
        spModal.open({
            title: "<b>Have you tried the following channels?</b>", // Title of the modal
            message: `
        <ul style="list-style-type: none; padding-left: 0;">
            <li>
                <a href="https://google.com" target="_blank">
                    <img src="Search_Onhover.svg" alt="Google" style="width: 50px; height: auto;">
                    Google
                </a>
            </li>
            <li>
                <a href="https://servicenow.com" target="_blank">
                    <img src="sn_icon.svg" alt="ServiceNow" style="width: 50px; height: auto;">
                    ServiceNow
                </a>
            </li>
        </ul>
    `,
            buttons: [{
                label: "Done",
                action: function() { // Add an action for the button
                    spModal.close(); // Close the modal when "Done" is clicked
                },
             
            }],

        });

    }
}
 
Can add customisations further in message as per requirement.
 
Pop up in portal :
ShwethaNair_0-1740636128474.png

 

 

Hope it helps 🙂

 

Thanks,

Shwetha

View solution in original post

6 REPLIES 6

I already tried something like this but looks like GlideDialogWindow is not supported

Error: This catalog client script is not VA supported due to the presence of the following variables in the script: GlideDialogWindow

Shwetha Nair
Giga Guru

Apparently, this is how I achieved it using just onchange client script as I found the UI page doesn't support in portal , also GlideDialogWindow was also not supporting in my instance. 

 

Script :

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }
    if (newValue == 'sysid' ) {
        spModal.open({
            title: "<b>Have you tried the following channels?</b>", // Title of the modal
            message: `
        <ul style="list-style-type: none; padding-left: 0;">
            <li>
                <a href="https://google.com" target="_blank">
                    <img src="Search_Onhover.svg" alt="Google" style="width: 50px; height: auto;">
                    Google
                </a>
            </li>
            <li>
                <a href="https://servicenow.com" target="_blank">
                    <img src="sn_icon.svg" alt="ServiceNow" style="width: 50px; height: auto;">
                    ServiceNow
                </a>
            </li>
        </ul>
    `,
            buttons: [{
                label: "Done",
                action: function() { // Add an action for the button
                    spModal.close(); // Close the modal when "Done" is clicked
                },
             
            }],

        });

    }
}
 
Can add customisations further in message as per requirement.
 
Pop up in portal :
ShwethaNair_0-1740636128474.png

 

 

Hope it helps 🙂

 

Thanks,

Shwetha