Freshdesk - Show Dialog - how to exit


I’m wondering about the dialog box in Freshdesk. When a user presses the X button, what is called?
I would like to exit the app then the X is pressed, but can’t find the “trigger” name.

Hello @Octopus.
Thanks for reaching out. You can simply use the Instance Method within the Modal Instance to close it. For this there are some points I would like to share before hand.

  • You need to add the cdn link to fresh-client.js in your modal.html template to access app object
  • Using the app object you can reinitialize the app within the modal context and use the client.instance.close(); method to invoke the close Modal Method.

Here is a sample that worked for me.

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <h2>Heyy Modal</h2>
    <button id="close">Close</button>
  <script defer>
    var client;


    async function init() {
      client = await app.initialized();

    function showModalContext() {
      client.instance.context().then(function (context) {
        console.log("Details of Modal Instance" , context);
    function addEventListeners() {
      document.querySelector("#close").addEventListener("click", function (e) {

Hope this helps :slight_smile:

1 Like

Hello @Kunal_Singh !

Thank you for your input, I’ve something like that. And I used your model as well. And yes, it does close the window - but does not exit the app. I would like to trigger the “function onAppDeactivated()” when pressing the X button in the window.

Since I’ve realised the app does NOT stop with the closing of the dialog box.

Hope you have an idea

Hi Octopus,

I too faced this issue. I sloved this issue by using client.instance.close() with the condition. Like if success response came from model page, close it.

Hope it will help you,


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