Workspace Modal popup issue

Steve214
Tera Contributor

We are trying to build a popup in workspace that validates an input then passes the input back to the form.  We built a UI Page that calls window.parent.postMessage then calls to close the modal.  The UI Action is using g_modal.showFrame. The X at the top corner of the modal does close the frame.  However, we are unable to close the modal using any of the following function calls from our confirm button: 

  • window.close()
  • window.parent.close()
  • GlideDialogWindow.get().destroy()
  • GlideDialogWindow.prototype.get().destroy()
  • GlideModal.get().destroy()
  • GlideModal.prototype.get().destroy()
  • GlideModal.prototype.get(<UI Page>).destroy()
  • var modal = new GlideModal().get(<UI Page>); modal.destroy();

We trying to identify what we may be missing or other methods to close a modal.  

 

 

1 REPLY 1

PS930585
Tera Contributor

Hi,

 

Use Case : Closing a modal in Configurable workspace when using showFrame.

 

Details : Requirement is to use g_modal.showFrame() that renders a UI page in Workspace. On clicking the Yes button in the modal the values are getting saved to the form but the modal doesn't close on clicking No button. e.g Below script is used to call the UI page in UI action workspace client script.

 

function onClick(g_form) {

    var ui_page_id = '67bf44dfc3c6fa102ffb563ed401312b';
    var changeNumber = g_form.getValue('number');
    g_modal.showFrame({
        url: '/ui_page.do?sys_id=' + ui_page_id + '&number=' + encodeURIComponent(changeNumber),
        title: 'Cancel the Change Request',
        size: 'lg',
        height: 300
    })
}

 

 GlideDialogWindow.get().destroy(); works for platform view but since this is unsupported for Workspace. Do you want to know what is the alternative for this in workspace that we can use in our UI page code? Solution: Add 'location.reload()' to the UI Page Client Script. It works for both Platform and the Workspace.

 

I hope this help!