How to close template.html opened with client.interface.trigger showModal

I have opened a custom form with following command:

    'showModal', useTemplate('Title of the Modal', './views/modal.html')

I would like to be able to close this form using a submit or cancel button. When the user successfully completes the form I want to close the window. I But other than the built-in ‘x’ I can’t find any way to close it.

I’ve looked thru the github samples and only one I found that comes close (iparams-json-omni-app in Omni-App Samples) has a “closePopup()” method but that must be a custom function because its not found. When I tried to run that sample its missing the openModal() method so looks like its an incomplete sample.

This is the contents of modal.html:

<!DOCTYPE html>
<html lang="en">

  <script src=""></script>
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=yes">  
  <script type="module" src=""></script>
  <script nomodule src=""></script>
  <link rel="stylesheet" href="../styles/styles.css" />

      <h1>Change Start Date</h1>
      <fw-datepicker value="2020-05-22" date-format="YYYY-MM-DD"></fw-datepicker>
      <fw-button color="secondary" onclick="closePopup()"> Submit </fw-button>
      <fw-button color="secondary" onclick="javascript:window.close()"> Cancel </fw-button>
<script src="./../scripts/app.js"></script>


as mentioned above ‘closePopup()’ does not work.

I figured it out. I finally found an example that used the following.


I wish there were better examples in the docs and more complete docs. Maybe i’m missing it. Is there any docs on all the properties and methods with client object?


Hey @stevemc,

Thanks for your feedback, your feedback will really help us in delivering a better developer experience

Stay Safe :slight_smile:

1 Like

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.