The Zurich release has arrived! Interested in new features and functionalities? Click here for more

How to cancel previous ui page after clicking ui action

Debarpita Basak
Giga Contributor

Hi All,

I want to cancel previous ui page after click ui action button it will reload fresh ui page and will cancel the other page which is loaded

full scenerio:

Please Help me i click one ui button(Send_deb) it will display 1st ui page then in first ui page if i click one button it will call the 2nd ui page then in 2nd ui page if i click one button(Deb) it will call the the same ui button which display the 1st page but cancel previous displayed 1st page and 2nd page . @ankurbiswas 

 

10 REPLIES 10

Hi Debarpita,

Apologies for the delay, please use the updated code. 

 

When UI Action is clicked, first popup displays.

When button on first popup is clicked, it closes and second popup displays.

When button on second popup is clicked, it closes and first popup displays.

************************************************************ 

Function in UI Action:

function openPop1() {
    var gDialog1 = new GlideDialogWindow('pop1');
    gDialog1.setTitle('Pop Up 1')
    gDialog1.setSize(700, 700);
    gDialog1.render();
}

  

 

UI Page 1 - Name : pop1

HTML

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

	<button class="btn btn-primary" onclick="showPop2()" >Show popup2</button>
	<button class="btn btn-primary" onclick="closeWindow()" >Close</button>
	
</j:jelly>

 

Client Script

function showPop2()
{
	GlideDialogWindow.get().destroy();
	
    var gDialog1 = new GlideDialogWindow('pop2');
    gDialog1.setTitle('Pop Up 2');
    gDialog1.setSize(700, 700);
    gDialog1.render();
}

function closeWindow()
{
	GlideDialogWindow.get().destroy();
}

 

 ************************************************************

UI Page 2  - Name : pop2

HTML

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

	<button class="btn btn-primary" onclick="showPop1()" >Show Popup1</button>
	<button class="btn btn-primary" onclick="closeWindow()" >Close</button>
	
</j:jelly>

Client Script

function showPop1()
{
	GlideDialogWindow.get().destroy();
	
    var gDialog1 = new GlideDialogWindow('pop1');
    gDialog1.setTitle('Pop Up 1');
    gDialog1.setSize(700, 700);
    gDialog1.render();
}

function closeWindow()
{
	GlideDialogWindow.get().destroy();
}

 

 

 

 

Long Live ServiceNow!