Automatically store PDF in file manager and later share it

Hi Everyone,
I’m kind of newbie to Bubble and I cannot solve this issue. I am automatically generating a PDF from a screenshot from an element in a page. I want to send this PDF to clients via email. I created a workflow with the PDF plugin to autosave this PDF into Bubble. The problem is that I can see the file myself, but I need a workflow to automatically extract that link to pass it as a param in my email service, so the user can receive the link via email.
I follow the solution proposed by @ilanmichalby in this similar question, but I cannot find a way to make it work:

Basically I use the “save to bubble” option when creating the pdf. It saves it just fine. I then created another workflow “when PDF/IMG saved” to save it into a field called “pdf” in my database (as file type), but it doesn’t save. I’ve been testing with all of these possibilities with no success:

Any idea I could try?
I just need to automatically grab the PDF URL after auto-save into file system so I can do the send-email workflow next.
Thanks in advance

If it is a file type then save file not URL,

1 Like

Thank you for the tip. I already tried different possibilities, including this:


And I still doesn’t save in the pdf field. If I don’t add the Page PDF URL after the PDF/IMG I get an error in the workflow.

hi, take a look here, it worked for me

Thank you very much for your response. I already tried to replicate what you did, and it still doesn’t work. I run some tests to see where the problem is. I replicated your same workflow. I generate the PDF from an element:


I then do the workflow to make changes to a thing when a PDF/ page or element is saved. I tried with both page or element just to be sure.

As you can see, I added another test field from the same table just to test if the problem is exclusively from the PDF, but the test field doesn’t update either. So, it seems that this workflow is not running after the PDF is saved. Otherwise, it will at least update the test field in the DB. Any ideas? Should I insert and intended waiting time between the PDF saved and the next workflow to allow time for the PDF to be created and be updated to the File Manager? I feel the issue is that the second workflow is not running at all, so it doesn’t update the record.
Thanks

I think I found it:
You should save the “This PDF/IMG Element PDF URL” instead of “This PDF/IMG Page PDF URL”

Thank you again for your response.
I tried with both options including “This PDF/IMG Element PDF URL” and it doesn’t save in the DB:


I also added a field called “observation” as a test. My idea was that if the PDF was the issue, at least it would update the test field with the dummy text I entered. The result is that there is no update for any of the fields (pdf & observation). So, I really think this workflow is not tiggered after I generate the PDF and save it into the file manager. Is there a way to force it manually?
Thanks

can you share the app with me? I want to check something

Sure, here it is:

The pertinent workflow is on that page “confirmapdf” when clicking on “generate” button.
Thanks in advance,

is it possible that the “parent group’s event” is empty?
I can’t see anywhere in the app where it gets the data from.

For this version of the app it is indeed empty. This is a sandbox sort of version of the real app that is in production. It has the same workflows, though. The data comes from the table “event”. In this sandbox, app is empty, but the production one has a bunch of events. Each event is created by a user through a calendar plugin. It works fine. You can add and edit events with no problem. The only issue I have is the PDF file that I cannot access. A user generate a PDF, and it saves into the file manager, but I need to save it as well into the field “pdf” of the table “event” after created. This is the workflow that doesn’t seem to be triggered.
I just did yet another test. This time I tried to update “observation” with dummy text when pdf is generated and saved, and yet it doesn’t work.


So, it is not the problem with the pdf, it seems to be the workflow that it is not triggered after the pdf is created and automatically saved into the file manager.
I’m running out of ideas here. Unfortunately, it is a functionality I need to work.
Thanks in advance,

just for testing, try to replace “parent group’s event” with “search for event:first item” and ses if it updates this event or not

I copied your page into my app, used the trigger “when pdf element saved”, changed the event to a random event from the db - and it worked

Awesome, thanks. This is some progress. I did the same and it saved the pdf generated.


However, it doesn’t save it in the correct event. It seems that it randomly assigns it to any event, not the one where it was generated from. For instance, I generated a pdf for an event that has the unique id 1729623019857x219897431834755070 and instead of saving the pdf in that specif event, it saved it into a different event, in this case into an event that has the unique id 1729625552898x908748472038195200. It should save the pdf in the correct event.
I did a test with “search for event:first item” and save the pdf in the first event of the Event table. I did another test with “search for event:last item” and it saved the pdf in the last Event of the table. So, “search for event:random item” saves the pdf into a random Event of the table. Now, I need to save the event into the right Event from the table. Maybe using conditions or states?

Thanks again.

I think I found part of the issue. The PDF generates with data that gets from page url.


I send this data from another page, where the calendar is.

I do this through a workflow “go to page” sending params to that page. I have to do that in order that when a user click on an event on the calendar, this info can populate the pdf on the next page.
So, yes, we could say that “parent group event” is empty. That’s why it seems it can only work if I use the “search for Events:random item” workflow.

It doesn’t know what event we want to update because the parent groups event is empty or is getting the data from the URL. Maybe if I send the unique id from the event as well, could I use this value to do a search for that specific event? Or maybe I have to change the entire logic of the app ?
Thanks