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:01 AM
Hi Cody,
It's because you are destroying your GlideModal before you are returning true. You don't need to do this if you are using the processing script, you just need to use the response.sendRedirect([URL]) to put the user where you want them to be after they've submitted your page, the GlideModal will automatically be destroyed. Alternatively you could use a GlideAjax call in your client script to call the server side processing.
OR take reference from script given below
This client-side function gets called either after the server-side update has completed and records are reassigned or the Cancel button is pressed.
c.closeModal = function() {
c.modalInstance.close();
spUtil.update($scope);
};
Mark helpful/correct based on impact.
Regards
Ajim.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2020 01:25 AM
Hi Ajim,
Thaks for your reply.
I am not using processing script(cannot use due to requirement restriction) so the first part will not work for me.
I am trying to understand your second solution, can you please explain what is 'c' object there because it is giving me an error c is not defined.
Thanks.
Regards,
Abhijit
ServiceNow MVP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2020 02:14 AM
Hi Cody,
if that is not working have look at this link then :https://community.servicenow.com/community?id=community_question&sys_id=904e4111db539380b2102926ca96...
find second answer of
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2020 02:54 AM
Hi Ajim,
I already tried that solution but no luck.
Thanks.
Regards,
Abhijit
ServiceNow MVP