Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

UI Action using GlideModal

aaron47
Mega Guru

 

Hello, my objective is to create a glide modal popup box to replace the "confirm" box.  This is because "confirm" is not supported by ATF.

 

The code below opens up a model box.

However when i click the "Close Pop up" button, it does nothing.  I was expecting the modal window to close.

 

Can someone please show me what went wrong?

function test(){ // client code

	var gm = new GlideModal('test');
	gm.setTitle('Test Pop up');
	gm.renderWithContent('<button style="padding:5px;margin-right:10px" onclick="window.closePopup" class="btn btn-default">Close Pop up</button>'); 
	
 window.closePopup = function(){
		gm.destroy();
	};
}

 

I should add, that I used this page as a reference for setting up the above:

https://www.servicenow.com/community/now-platform-articles/custom-glide-modal-dialog-boxes/ta-p/2321...

 

 

2 REPLIES 2

Mike_R
Kilo Patron
Kilo Patron

I would recommend using one of the ootb GlideModals instead.

Some examples provided here

https://davidmac.pro/posts/2022-02-08-glidemodal/

zz2
Tera Contributor

A little late to the party, 

but the following should fix your problem:

 

function test(){ // client code

	var gm = new GlideModal('test');
	gm.setTitle('Test Pop up');
	gm.renderWithContent('<button style="padding:5px;margin-right:10px" onclick="top.window.closePopup" class="btn btn-default">Close Pop up</button>'); 
	
 top.window.closePopup = function(){
		gm.destroy();
	};
}