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?
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.