How to close GlideModal window on click of submit button.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2020 11:52 PM
Hello Experts,
I am opening UI page on click of UI action with GlideModal class. I just want to close that page on click of submit button(after performing some operation). Seems GlideDialogWinow.get().destroy() doesnt work.
Any help would be appreciated.
Thanks in advance.
Regards,
Abhijit
ServiceNow MVP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2020 12:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2020 01:32 AM
Hi Ashutosh,
Thanks for your reply.
I cannot use processing script. Please help with alternative solution.
I am calling script include from client script to fulllfill my requirement, I was thinking to redirect from there but nothing works there as well.
Strange that we do not have any method to just close the modal window like we have GlideDialogWindow.get().destroy() for GlideDialogWindow.
Thanks.
Regards,
Abhijit
ServiceNow MVP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2020 06:59 AM
Here's how I do mine, and has always worked:
Somewhere in my UI Page HTML I'll have a button:
<button onclick="closeMe()">close</button>
You could name it Submit or whatever.. the main piece is the Client Script code:
function closeGlideModal() {
try {
GlideModal.get().destroy();
}catch(err){
console.warn("closeGlideModal ERROR: "+err.message);
var x = document.getElementById('THE_NAME_OF_YOUR_UI_PAGE' + '_closemodal');
if (x) {
x.click();
} else {
console.warn("No 'X' close button found!");
}
}
}
function closeMe() {
setTimeout(function(){
closeGlideModal();
},100);
}
Just remember in your client script to change
THE_NAME_OF_YOUR_UI_PAGE
to the name of your UI page:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2024 04:47 AM
GlideModal.get().destroy();