Does zendesk zaf have the ability to prompt for confirmation?

Respondida

5 Comentarios

  • Dev

    Hello Andrew,

    I didn't hear about such feature. When I need confirmation in pop-up, then I use modal location. You can add confirm/cancel buttons and set local storage item on confirm. Then you can check if local storage item is presented in modal close callback to see if agent confirmed the action.

    Best regards,
    Andriy

    0
  • Andrew

    Andriy,
    How are you returning values back from the modal? I'm using 

    this.client.invoke('instances.create'...
    To create the modal and the url is an internal html file that just has <p></p> and 2 buttons. How can I get it close the modal when I click one of then be able to tell which button was clicked so i can call additional functions?

    It seems like most of the documentation on modals is on how to call them not how to send data between the it and the app.

    thanks,

    Andrew Wells  
    0
  • Dev

    Hi Andrew,

    You can send events between locations, but I don't remember how to do it. Usually, I use local storage for stuff like that (all app locations share it). So, for example, you need to add an onClick event for a confirm button like this:

    const onClick = () => localStorage.setItem('confirm', 'confirmed')

    Then, you need to add a handler for the modal.close event in the place where you create modal window like that:

    client.invoke('instances.create', options).then(context => {
    const modalClient = client.instance(context['instances.create'][0].instanceGuid)

    modalClient.on('modal.close',() => {
    const isConfirmed = localStorage.getItem('confirmed') === 'confirmed'
    if(isConfirmed) {
    // Make sure to clear localStorage to make sure agent will need to confirm future actions
         localStorage.removeItem('confirmed')

    // Here you can do any action on confirmation
    handleConfirm()
    }
    });
    });

    Best,
    Andriy

    1
  • Tipene Hughes
    Zendesk Developer Advocacy

    Hi Andrew, Dev,

    Here's a link to a section of our documentation that details how two app instances can interact with one another:

    Messaging between locations

    Here is a link to a Github repository demonstrating the concept using a top bar and background app:

    Github Repository

    I hope this helps! Feel free to reach out with any questions.

    Tipene

    0
  • Andrew

    I ended up using the local storage option this time around. I did take a look at how to use the client.on("trigger name",()) and the client.trigger("trigger name", "") options but I couldn't wrap my head about how you pass the sidebar client to the modal for it to call back. I'll have to play around with it some more before it clicks, but for now the local storage option works for what I'm doing.

    Thanks,

    Andrew Wells   

    0

Iniciar sesión para dejar un comentario.

Tecnología de Zendesk