How to call GlideDialogWindow from client script of another ui page

Pooja Mahamuni
Tera Contributor

Hi,

 

I have created one button UI action on form. When we click on button then dialog box opens up which has Cancel and Submit button. Till here everything is working fine. Now when we click on Submit button, another dialog box should open which also need users confirmation asking "do you want to Add or replace" which has 2 buttons "Add" or "Replace". Is there any way to achieve it?

 

Thanks

Pooja

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

@Pooja Mahamuni 

the function in client script which gets invoked when Submit is clicked should have GlideDialogWindow() code to invoke the 2nd UI page

what did you try so far and what didn't work?

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

GopikaP
Mega Sage

Hi @Pooja Mahamuni , inside the onClick function where you are calling the first UI Page - 

var first = new GlideModal('ui_page_name');
first.setTitle('Sample Text');
first.setPreference("onPromptComplete", function() {
//try to write the second GlideModal here - 
var second = new GlideModal('second_ui_page_name');
.
.
.
}
first.setPreference("onPromptCancel", "cancel");
}

Please see the screenshot also.

GlideModal References - GlideModal usage and examples

Pooja Mahamuni
Tera Contributor

Hi Ankur,

Thanks for responding!

I tried GlideDialogWindow() code to invoke the 2nd UI page in client script of first UI page. It is showing that 2nd  dialog box but it is not waiting for user's response and getting disappear again and redirecting the page. I added timer also but it did not work. 

 

 

Client script code of first UI page

function onSubmit() { //called when submit button clicked
   

    setTimeout(function() {
        openPage();
    }, 1000000);
   
}

function openPage() {
    var popup = new GlideDialogWindow("try"); //2nd ui page
    popup.setTitle("Title"); //Set the dialog title

    popup.setWidth(600);
    popup.render();
}

@Pooja Mahamuni 

so the 1st dialog window should not disappear?

what's your requirement?

Why not show the Add or Replace buttons on click of submit and don't use 2nd UI page?

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