Does zendesk zaf have the ability to prompt for confirmation?
RespondidaI'm building a side bar app and in one use case the agents have the ability to delete a row. I would like to know if there is a way through Zendesk to send a prompt say "Are you sure? this cannot be undone."
When i mocked this out i used:
confirm("Are you sure you want to delete this row? You cannot undo this action.")
but it seems like i cannot do that while in an iframe. If anyone has any suggestion I would appreciate it.
cheers,
-
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 -
Andriy,
How are you returning values back from the modal? I'm usingthis.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 -
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 -
Here's a link to a section of our documentation that details how two app instances can interact with one another:
Messaging between locationsHere is a link to a Github repository demonstrating the concept using a top bar and background app:
Github RepositoryI hope this helps! Feel free to reach out with any questions.
Tipene
-
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
Iniciar sesión para dejar un comentario.
5 Comentarios