How to close GlideModal window on click of submit button.

Abhijit4
Mega Sage

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.

 

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP

8 REPLIES 8

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI,

You can see this:

find_real_file.png


Thanks,
Ashutosh

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.

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP

xiaix
Tera Guru

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:

find_real_file.png

Prana Krushna
Giga Guru

GlideModal.get().destroy();