Running a workflow when a Link is clicked?

I have file attachments showing as a repeating group. The first column is a link that when clicked opens the URL of the file in a new tab. I want a workflow to run that creates an audit record, which shows the filename, and who downloaded it but it doesn’t seem like you can create a workflow on a link?

Previously I had it as a text field that when clicked would create the audit record and then navigate to the attachment’s URL, but that opens it in the same window which is why I preferred using a link.

Alternatively, if it’s not possible is there a way to click a text field and have it download a file that’s uploaded instead of navigating to it by URL? I didn’t see any workflow action for “download file.” Thanks!

There is a workflow action to open an URL in another tab, so perhaps you could replace your link by a button and open the link through the workflow?

Unfortunately, there is not option to simply download a file. Few weeks ago I spent a lot of time trying to figure out a solution for this. I know it’s possible with a javascript code calling a php script through Ajax, but I didn’t got to make it work how I wanted. The simple solution I found is to buy the plugin “Easy File Downloader” from Zerocode. Works perfectly.

1 Like

There’s a workaround for this. Simply place an element (any element that can render a workflow - i.e. text, button) then create your workflow. Next, replace the element with a link element (making sure you scroll down and click the “REPLACE” button in the edit box). You’ll find that the workflow you set for the previous element will transfer to the link element. I believe this is a bug in Bubble’s system, however, one that has been working perfectly fine for years.

7 Likes

Cool, I didn’t know that! Thanks for sharing!

Awesome hack. Thanks!