custom Pop up message

pk2184046
Tera Expert

Hi there,

 

I have a requirement based on the variable selected in the record producer. We need to populate the pop up message which should have 4 buttons upon selection we have to redirect to a specific form in the portal.

What is the best way and how can we achieve this ?

9 REPLIES 9

@pk2184046 

so they want 4 buttons and each button will take them to some other URL?

If yes then do something like this but please enhance to show other 3 buttons and write that in onChange catalog client script

Form the complete HTML string and put in HTML variable below

Script:

var html = '<a href="https://www.w3schools.com" target="_blank">Visit W3Schools.com!</a>';
// Use spModal to pop the HTML
if (html) {
    spModal.open({
        title: 'My Confirm Box',
        message: html,
        buttons: [{
            label: 'OK',
            primary: true
        }],
    });
}

Output:

AnkurBawiskar_1-1749105996131.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar 

Thanks for the efforts it is working fine but the thing is on click of the buttons I need to redirect to the form and the form values to be copies as well. 3buttons 3 different forms and fourth button will be cancel button which stays on the same/current page

@pk2184046 

I just shared a sample script and you can enhance it further to show buttons.

Since you want form value/variables to be copied, you will have to include them in URL as parameter and then write onLoad client script on respective forms to get the values from URL and set on the varaiables/forms

check these links on how it can be done

How we can set the variables on catalog item form from UI action.  (recommended)

Redirect from a UI Action to a Catalog Item and set default values 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar 
Currently I can redirect the users using the spmodel like belowScreenshot 2025-06-06 105002.png

 

Instead of thsi can we populate similar to cancel button once we click on those button it should redirect to the forms ?

3 buttons for 3 forms 4th button will be a cancel button if user clicks on that he/she will stay on the same/current page

@pk2184046 

I already shared sample example logic, you need to enhance it as per your requirement.

how you can send values in URL and how to get, I already shared links for that above.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader