close tab event



  • Christopher Kennedy
    Zendesk Developer Advocacy
    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.
  • Ben Graham


    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');
    }, 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!



Please sign in to leave a comment.

Powered by Zendesk