Top Bar App Access To Current Ticket

4 Comentarios

  • Greg Katechis
    Zendesk Developer Advocacy

    Hi there! So you were on the right path in the last paragraph, with respect to running a hidden sidebar app to pass the data up to the top_bar location. We do have a sample app that covers this topic, specificallythis partof the app. The code is pretty clearly commented, but it doesn't give full instructions on how to do it, so if you run into any issues seeing how we handle instances and pass the data around, let me know and I'll be glad to help.

    1
  • static void

    Greg KatechisThank you!

    I was able to get handlers to sidebar instances from my top_bar app using the example code you provided me with.

    I have another concern that I would like to get your assistance with if possible.

    In case of the user refreshing the app after already having three different ticket tabs open, when I run client.get("instances") I get an array of different side_bar instances that are already opened, but I'm trying to figure out if I can determine who is the currently active one.

    I noticed that if I hard reset + clear cache from the browser, I will only get the current active instance.

    Any ideas on how I can workaround this issue?

    Thanks!

    1
  • static void

    I would like to add that this seems intermittent, such that most of the times this is OK.

    When I try to replicate a scenario that a user with multiple ticket tabs will refresh their page, client.get("instances") only returns the active ticket side_bar instance.

    But still, if there is a way that I can verify while iterating over the instance list who is the actual active instance, I will be happy to know how to do that.

    0
  • Greg Katechis
    Zendesk Developer Advocacy

    Yeah, so that is definitely a side-effect that exists when you've got and I have not solved myself, nor have I seen an example of it being solved. The reason that you're seeing different behavior after a hard refresh is because the apps in the other tickets tabs have not yet been registered/activated after a refresh, so you will only get the data for that currently open ticket tab. Since "tabs" in the Zendesk agent interface don't function the same way that tabs do in a browser...specifically in that they are not separate windows, along with all of the cascading bits of the DOM tree...they won't work as you might expect. The ticket "tabs" all live within one browser window, so parsing out the different instances of the app in different tickets is basically a nightmare.

    All of that being said, we do recommend using local storage to juggle this around and you can read about thathere. You could use the ticket_id as the key/value pair in local storage and then look at that to match the current active ticket to the appropriate installation_id. Which is probably not exactly what you're looking for and it's also a little (read: a lotta) bit janky, but it may give some ideas for how you can accomplish this.

    It's a lot of words to say there isn't a great answer, but if the above gets you moving in the right direction, please share that with us, we'd love to get ideas coming back to us!

    0

Iniciar sesiónpara dejar un comentario.

Tecnología de Zendesk