I've been trying to open a pdf via action button in my app... I know in order to do that... I must first trigger the pdf generation bot via a data change in my table... So to do that I created a hidden (do not display) action to cause the data change... But I realised that it doesn't sync the change immediately... So I created another hidden action to link to the same view I was viewing and force a sync... Lastly, I created an action to open the pdf file the bot created... All the actions work perfectly independently.... But as soon as I try to group them in order.... The data change works, the forced sync works but the pdf download doesn't.... I tried shuffling their order and realised that after the forced sync nothing works... Why? Any help?
Solved! Go to Solution.
@Omega wrote:
So I created another hidden action to link to the same view I was viewing and force a sync
Any executed navigation action in a Group will end the group execution. I say "Executed" navigation because the action can have conditions. If it DOES NOT get triggered, the Group WILL continue to the next action and proceed to the end or next Group ending action - Delete of the row in context will also end the Group.
Having said that, a Sync will not solve your problem. Some PDF generations will take longer that your set of actions and still will not be available to launch for viewing
It seems you are attempting to generate and automatically open the generated PDF as soon as it is completed. While this might be possible as long as PDF generation times are short, it is not advisable for the best user experience. Because the PDF generation takes time, either the user would need to wait OR when the PDF does finally open, it would interrupt whatever other activity the user is involved with. You don't want either of these.
Instead, I recommend separating the generation of the PDF from the viewing of the PDF. There are multiple ways to do this:
1) Send an email with the PDF attached. The easiest way and can be included in the generation Bot.
2) Send a Push Notification with a link to the PDF file. Still easy, included in generation Bot, but need to insert the proper link to the file in the notification.
3) Make a view button appear in the app once the PDF is created. This can take some effort but is more robust for the app. User can access the file at anytime. The easiest approach here is use a Google folder as a table source. You can read more about that here
I hope this helps point you in the right direction.
@Omega wrote:
So I created another hidden action to link to the same view I was viewing and force a sync
Any executed navigation action in a Group will end the group execution. I say "Executed" navigation because the action can have conditions. If it DOES NOT get triggered, the Group WILL continue to the next action and proceed to the end or next Group ending action - Delete of the row in context will also end the Group.
Having said that, a Sync will not solve your problem. Some PDF generations will take longer that your set of actions and still will not be available to launch for viewing
It seems you are attempting to generate and automatically open the generated PDF as soon as it is completed. While this might be possible as long as PDF generation times are short, it is not advisable for the best user experience. Because the PDF generation takes time, either the user would need to wait OR when the PDF does finally open, it would interrupt whatever other activity the user is involved with. You don't want either of these.
Instead, I recommend separating the generation of the PDF from the viewing of the PDF. There are multiple ways to do this:
1) Send an email with the PDF attached. The easiest way and can be included in the generation Bot.
2) Send a Push Notification with a link to the PDF file. Still easy, included in generation Bot, but need to insert the proper link to the file in the notification.
3) Make a view button appear in the app once the PDF is created. This can take some effort but is more robust for the app. User can access the file at anytime. The easiest approach here is use a Google folder as a table source. You can read more about that here
I hope this helps point you in the right direction.
Thanks for the reply... I figured this approach wouldn't work and found a way to separate the pdf generation from downloading and viewing it...
I created an action button to create the pdf... and configured another action button to pop up to download the pdf....
I tested this new approach and found the pdf was generated and ready to download all the time whenever the download action had been triggered...
I'm not an expert and iยดm still triying to do this myself but im working on a script in google apps script, this is my second try by now:
function waitAndCheckPDF(e) {
var ticketId = e.parameter.ticketId;
var pdfUrl = e.parameter.pdfUrl;
// Esperar 20 segundos
Utilities.sleep(20000);
// Verificar si el PDF estรก disponible
var response = UrlFetchApp.fetch(pdfUrl);
var pdfGenerated = response.getResponseCode() == 200;
if (pdfGenerated) {
// Actualizar la hoja de cรกlculo o Base de Datos
var sheet = SpreadsheetApp.openById('YOUR_SPREADSHEET_ID').getSheetByName('Tickets');
var data = sheet.getDataRange().getValues();
for (var i = 0; i < data.length; i++) {
if (data[i][0] == ticketId) { // Suponiendo que la primera columna es el ID del ticket
sheet.getRange(i + 1, 'PDF Generado Column Index').setValue('LISTO'); // Reemplaza 'PDF Generado Column Index' con el รญndice de la columna real
break;
}
}
}
return ContentService.createTextOutput(JSON.stringify({pdfGenerated: pdfGenerated})).setMimeType(ContentService.MimeType.JSON);
}
Sorry it becomes messy when i try to paste it here i hope it helps ๐
User | Count |
---|---|
17 | |
7 | |
6 | |
5 | |
3 |