How to call GlideDialogWindow from client script of another ui page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2025 03:12 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2025 05:21 AM
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.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2025 05:41 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2025 05:53 AM
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();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2025 05:56 AM
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?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader