Zendesk Pop Out the application with the data from Zendesk Admin conf and Other Ticket related Data



Gepostet 28. März 2022

Hi Team,

I was trying to Pop-Out my app with the click of a button.
The pop-out part is working but once the app is opened in a new pop-out window it detaches with the data from the Zendesk Ticket.
It is not able to get the data like.

ticket.id, ticket.requester.email etc


The code block I am using is below :

function openModal() {
ZendeskService.zafClient.invoke('instances.create', {
location: 'modal',
size: { // optional
width: '80vw',
height: '100vh',
},
}).then((data) => {
console.log(data);
});
}

This is not providing me with any data from the Zendesk Ticket.
Here is my ZendeskService class for reference.

class ZendeskService {
static zafClient;

static initialize(callback) {
try {
DomService.loadScript(ZENDESK_URLS.SCRIPT, () => {
if (window.ZAFClient) {
ZendeskService.zafClient = window.ZAFClient.init();
if (typeof callback === 'function') {
callback();
}
}
});
} catch (error) {
console.error(`Failed to load Zendesk client: ${error}`);
}
}

static get = async (key) => {
if (ZendeskService.zafClient) {
try {
return (await ZendeskService.zafClient.get(key))[key];
} catch {
return null;
}
}
return null;
};
}

export default ZendeskService;

0

1

1 Kommentar

Hi MPZ! The reason that it isn't working is because the ticket data that you're looking to retrieve from the modal is only available in the ticket_sidebar or new_ticket_sidebar locations. ZAF doesn't have a clean way of passing data from one app instance to another, however we do have an example app that shows you how this is done here. If you check the main.js, you'll see that we're passing data from the ticket sidebar to the top bar, but you can tweak that to work with a modal instead. It's pretty heavily commented, but if you have any questions, let me know!

0


Anmelden, um einen Kommentar zu hinterlassen.

Sie finden nicht, wonach Sie suchen?

Neuer Post