Apply a condition to the ‘Do when a condition is true’ workflow. Could be when a new booking is made or something like that.
Set the workflow event to ‘Everytime’
The field to watch would be the related to the ‘Type of thing’ set in the custom event which is ‘TaxiBookings’ with the field to watch then being ‘DriverUser’.
Then on the custom event could be the JS for the audio to play and you could use a condition on the Custom workflow so that only when ‘Current workflow TaxiBooking DriverUser is current user’
Haven’t tested but something like this should work…If you setup a test environment I can check
Then on the custom event could be the JS for the audio to play and you could use a condition on the Custom workflow so that only when ‘Current workflow TaxiBooking DriverUser is current user’
Is the bit where I’m a little confused. What should I put here?
The Workflow data can be the repeating group (if the data type matches which is should do) or you can ‘Do a search for’ and filter/constrain any data you need.
Try :Last item as its expecting a single item. The last item should be the latest, can also be changed with the :sorting modifier to most recent (from the created date) as last entries.
Looking into this and creating a similar type setup to yours, this is possible. Here are the necessary steps, but just note, in production with hundreds of users results may vary due to the high workflow rate, so something to bear in mind and test.
See the example page I setup that does a live demo:
I suggest opening 2 web browsers. Click the ‘Login as John’ on 1st web browser, this logs you in as a driver, you’ll then be able to see the relevant bookings in the repeating group to the right, as they come in. Then on the 2nd web browser, you can create a new booking, by selecting the driver and then clicking the ‘Create a new booking’ button.
You should then see the new entry load in and hear the notification sound run. The sound is sometimes played once or twice depending on timing of the workflow event running. This is due to the setup of using the range of 2 seconds, more explain below:
Create a new workflow on the page:
You can set the interval to lower values e.g. 0.5, but for performance I think 1 is fine.
Now in the repeating group we are searching for entries on the ‘TaxiBookings’ data type:
The entries will only be show to the current user who is the driver. Privacy rules would need to reflect this too.
Anyhow, onto the Javascript step.
The ‘Only when’ condition is important here and thats whats being run every 1 second. Firstly it will create a 2 second window using the range modifier. This will be the current date/time along with an extra 2 seconds. The reason for this range is that the workflow was unreliable if it was exact e.g. contains or is using an exact date/time in either date format or text when compared.
It wasn’t quick enough it appears to check the conditions and then run the workflow. Some improvements and experimentation could be made here, but from a quick test worked. As mentioned sometimes in this period the audio workflow action will run once or twice depending how it catches in the date/time range.
We then match the time window to the repeating groups last items creation date.
I know this was done a long time ago, but i am also wondering how to do this. Ur explain is beyond me, and i do not understand… If you have discord, and could help on a call, that would be awesome.