Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Need to Close GlideDialogWindow which uses iFrames

vikasbulchandan
Tera Contributor

Hi All,

I have a popup opened using GlideDialogWindow which opens an UI Page which uses iframe and its source is another UI Page. I am trying to close the pop through client script of referred UI Page, but its not working. Here's the code snippet.

Parent UI Page:

<?xml version="1.0" encoding="utf-8" ?>

<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

<j:set var="jvar_chgSysId" value="${RP.getWindowProperties().get('chgSysId')}" />

<div class="xm-dialog-form">  

  <div class="embed-responsive xm-embed-iframe" style="height:700px; width:1000px">

  <iframe name="dialog_frame" id="dialog_frame" src="/ui_page_referred.do?sysparm_nostack=true&amp;jvar_chgSysId=${jvar_chgSysId}" class="embed-responsive-item"></iframe>  

  </div>  

</div>

</j:jelly>

Client Script of Referred UI Page:

GlideDialogWindow.get(window.parent).destroy();

//window.parent.close();

Both of above statements are not working. Can you please help me.

1 ACCEPTED SOLUTION

If you're running this from within the iframe I would take a look at using parent or top to get back to the page hosting the iframe and close the GDW from there.


View solution in original post

6 REPLIES 6

Maybe try it with top instead.


Thanks Brad.. This was helpful. What I did was wrote a client script function in parent UI page which closes the GDW . Then used window.parent.functionName() to call that. That worked for me.



Thanks for the help!!