Close Custom Application when switching between tickets

I’ve created a custom application in freshdesk and I’m showing a modal with a form.
I’m trying to close the application when closing the modal and make sure the app is closed when switching between tickets.
Is there a way to programatically close the application? And is there a way to to close the app when switching between tickets?

1 Like

Hi @Daniel_McGhee,

Welcome to our Community! :tada:

It’s not possible to close the application programmatically. Only the app in the CTI placeholder can be closed programmatically. This placeholder would not be suitable for all the apps use-case.

Could you share what is the use-case for the need for this feature?
Which placeholder is the app placed on?

The app is located in the ticket sidebar.
When the application opens I open a modal containing a form to submit data partially from ticket info and partially from agent input to insert data to our db. When switching between tickets the ticket data is not being reflected, and the modal opens again automatically.
At the least I would want the modal to stay closed, and ticket info to update. Is this possible?

1 Like

@Daniel_McGhee In which app lifecycle event, is the modal being opened?

You can checkout this topic for a similar issue and this solution might be helpful for you to place your modal opening code under the right app lifecycle event.

If that would not still work, you could have a timeout that waits for the ticket data to be updated from the page and then open the modal.

1 Like

Hi Daniel,

Did you try using Instance API?

2 Likes

Hi working on it right now, I think the lifecycle methods might have been the solution. I am using the Instance API when submitting the form in the modal. I’m also adding a button to the custom app to open the modal form instead of relying on the lifecycle to open once the app is initialized.

Thanks for the help, I’ll give more detail once I complete my work.

1 Like

Everything seems to working ok now after switching the location of a few tasks. I added a button to the custom app to open the modal instead of relying on the app lifecycle but I moved the data collection into the modal itself and into app.initialized().

Thanks everyone for the help suggestions and pointing me into the right direction.

1 Like