Run workflow until unique random item is found

There was a great post on avoiding duplicates for random items by setting a custom state and adding the random item to a list. Since that topic is closed, I wanted to ask here- wouldn’t the custom state be reset every time the page is refreshed?

Instead I was just going to create a thing in the database and add the random item to a list then search against that list to avoid duplicates. Is this a job for a recursive workflow?

My goal is to make sure I’m running my workflow until a unique random item is found. That is, if the random item selected is already on my list of used items, I want to ensure that the workflow runs again until a unique one is selected.

Hi there, @sydney22… yes, you are correct that a custom state is reset every time the page is refreshed. So, if you are able to save a list of used items somewhere in the database (and if I understand your post correctly), getting a random item that isn’t in the list of used items should be as simple as something like this.


In that example, I am using a custom state to store previously selected users, but that was only for the example. You would replace the custom state list with your list from the database, and you should get the desired result.

Hope this helps.



Thank you for the thorough explanation, @mikeloc! So it looks like this setup would remove the need for a recursive workflow?

I don’t know exactly what you are trying to do, but a recursive workflow shouldn’t be necessary. My example is just a simple search minus another list.

1 Like

Gotcha- yes yours makes much more sense.

1 Like