close tab event
AnsweredI have created a custom nav_bar app for our unique workflow because views were not working well for us, and we are running into an inconvenience when closing tabs via the 'x' on the tab.
I have a background app running that listens for a ticket save event and in the case where "close tab" is selected it invokes a 'routeTo'... to return the user back to the custom app.
Is there a way to also tell when the 'x' is clicked on the tab to have the same behavior instead of redirecting the agent back to home or views??
Thanks!
-
Hi Ben,
When the agent closes the ticket tab, that instance of the ticket sidebar app is destroyed. You can take advantage of this fact for your use case. When the ticket sidebar instance is created, provide that instance to the background location. This will allow the background instance to keep track of the lifecycle of that sidebar instance.
-
UPDATE
I was able to accomplish what i wanted. This is what I am doing within the background app. Please let me know if you think there is a better/cleaner solution.
client.on('incoming_call', function(instanceGuid) {
let checker = setInterval(function() {
client.get('instances').then(function(instancesData) {
instances = instancesData.instances;
if ( typeof instances[instanceGuid] === 'undefined' ) {
client.invoke('routeTo', 'nav_bar', 'helpdesk-2.0');
clearInterval(checker)
}
});
}, 1000);
});Thanks Again!
---------------------------
Hey Christopher,
I am attempting to implement your suggestion but I am having difficulty determining whether or not this sidebar instance is destroyed.
I am first (within the sidebar app) calling client.context to obtain the side_bar GUID and then passing it on to the background app.
I am then attempting to call client.instance(... ) with the passed GUID. (I assumed this would work since the documentation states that the sidebar instances are transient and therefore destroyed upon closing the tab), but I am still getting an object/return for the instance GUID even after closing the tab.
What am I doing wrong, or do you have an alternative suggestion on how I should be doing this? Thanks!
Ben
Please sign in to leave a comment.
2 Comments