How to trigger a sound when a database item is added

Hi, I am making an app that checks items in and out. I will use a library as an example.

Users can request to have books put on hold for them. The library has a list of all the books requested from their library, and each library has access to only the list of the books requested from their library, which is displayed on a Library Admin page. The list pulls from the Request Data type, which has a list of Books requested, the Library it’s associated with, a yes/no of if the Request is satisfied, and the User who requested the books. The list displays requests only for the Library currently looking at it and unsatisfied requests.

Users can create a Request Data, or the Library can create a custom one if the User did not request ahead.

I need a notification sound to play every time a User creates a Request Data (or every time a Request Data is made, if that’s easier) so the Library knows their request list has been updated. I’ve found multiple plug-ins to handle making the sound, I am just confused on where to put the sound in the workflow. Is it an API thing, or should it be on the Library Admin page? Will it only work if the page is open?

Thanks so much!

On your sound data type, you can have a yes/no field that is called soundPlayed, which defaults to “no”. You could then have a “do when condition is true” workflow on the page that searches for all sounds with soundPlayed as “yes” and if one exists, play a sound (using a audio player plugin) and then mark the record as soundPlayed equal to “yes”

Let me know if that makes sense

:link: Connect with me

Take a look at this demo I made for my Tabby Navigation plugin.

It does exactly what you want. Go to the last tab and click the button!

~ You dont need my plugin to do this but it’ll help :wink:

This worked! I took it a step farther and did “Do every X seconds” and then set the condition to do when true.

So what worked was Do every 30 seconds, Only when: Do a search for Notifications (where Library to sound = Current User’s Connected Library and Sound Played = “no”) :count is not 0.

Then for the Steps within the workflow I did Step 1 as the call to the plug-in to make a sound, and then Step 2 Made changes to Notification to set the “no” to “yes” (Search for Notifications (where Library to Sound = Current User’s Connected Library and Sound Played = “no”) :first item).

This way the page is constantly looking for new notifications so it knows to make a sound so the Library manager knows to look at the screen.

Thanks so much!

1 Like

That’s great! I think you could use a “do when condition is true” and it should be instant and also save your page running a workflow every 30 seconds, but go with whatever works, that may well work better for your use case!

All the best :slight_smile:

1 Like