Skip to main content

Hi,


I need to get the new ticket data when using the next/previous button. I see that there is an event "ticket.propertiesLoaded" but this is only working with "ticket_background" location.


So basically I need to execute this code, whenever a ticket is loaded:

client.data.get("ticket").then(function(data) {

//get new ticket data

});

 

The previous/next events are not working for me, because these are triggered before new ticket data is loaded.

Hi Rafael,

     If you want the fresh ticket data to be loaded everytime you navigate between the tickets, you can use the same code that you used with ticket_background location. You need not wait for the property loaded event. Make sure the code is encapsulated within app.activated.


client.data.get("ticket").then(function(data) {

//get new ticket data

});




Sorry its not working. I am using this code:


 

app.initialized().then(function(client) {



executeMe(client);



});



app.activated().then(function(client) {



executeMe(client);



});

the executeMe function is only triggered when viewing first ticket, using next/previous does not work. 




Hi Rafael,

    oops, that's unfortunate and it shouldn't happen that way. Just a quick question. Are you testing the apps locally with ?dev=true or you have published them as custom apps? Also in the above code encapsulate the app.activated within app.initialized.


I published the app. Can you show me an example with the encapsulation.




Sure, Rafael. Here is an example.


app.initialized().then(function(_client) {

client = _client;

client.events.on('app.activated', function() {

client.data.get("ticket")

.then(function(data) {

console.log("Ticket Data", data);

})

.catch(function(e) {

console.log('Exception - ', e);

});

});

});