Efficiently triggering a workflow when something is created in the database from another page?

Hey bubblers!

I have an efficiency question for y’all.

I want to trigger an action, Play Howler, when a specific item is created in the database. The item is created by a different user on a different page.

What I’m doing right now works, but holy heck is it chewing up WU’s. I currently have a “Do every 5 seconds” workflow that searches to see if a new item has been created, and if so, it will play a sound.

Is there a better way to do this than performing a search every 5 seconds?

How are you determining if a new item has been created?

Right now, the search I’m running looks for items where Created Date > Current date/time+ seconds -5 (run every 5 seconds)

Yeah… you definitely don’t want to do that… (but Bubble has real-time search, so there’s no need).

Here’s a simple way which won’t cost any unnecessary WU…

Have a Group as a real-time variable (call it ‘Group var - Most Recent Item’) to hold the most recently created Item (i.e. search for items, sorted by created date, descending yes, first item).

Also have a custom state on your page (called ‘Most Recent Item’) to hold the most recent item (as a static value), and set this on page load to be the value of the variable mentioned above.

Create a conditional workflow (when Group var - Most Recent Item’s Item is not This Page’s Most Recent Item), and in that workflow run whatever actions you need to run (i.e. Play Howler), and then set the Page’s custom state (Most Recent Item) to the new value of the Group var - Most Recent Item’s Item.

1 Like

Brilliant! Thank you

This topic was automatically closed after 70 days. New replies are no longer allowed.