Custom app collapse modal window

Hi.
I have a question how to expand/collapse the modal window (see attachment).
When I click the modal window, then window is being opened. but then I close it and this modal is still opened and I need to collapse it manually before to open the modal again. How can I close it automatically when modal is being closed. code example is below:

manifest.json

"product": {
    "freshdesk": {
      "location": {
        "contact_sidebar": {
          "url": "template.html",
          "icon": "icon.svg"
        }
      }
    }
  },

app.js

document.addEventListener("DOMContentLoaded", () => {
    app.initialized()
        .then((_client) => {
            window.client = _client;
            client.events.on('app.activated', () => {
                client.interface.trigger('showModal', {
                    title: 'title',
                    template: 'template2.html',
                })
                .then(() => {})
                .catch(function (error) {
                    console.error('unable to open find alias modal: ', error);
                });
            });
        })
        .catch(function (error) {
            console.error('Failed to initialize the app with error: ', error);
        });
});

@Serhii_Svyrydenko,
Good Day!
Welcome to the community!

As per our understanding, the modal you are referring is contact side bar and another is modal window?
and from the app i.e contact sidebar location, you are triggering to open the modal,
and when the modal is closed you need to close (minimize) the app as well?
is my understanding correct?

if so, it is not possible to close the app programmatically, but you can close the modal.

I will suggest another alternative to open the modal, place a button inside of the app and use button click event to open the modal when ever it is needed.

hope it helps :slight_smile:

Thanks.

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