Prevent duplicate entry being added to the database

Hi all! I’m trying to create a new thing (add an entry to the database) using a predefined formula which is: Current year + Calculate RandomString (6 characters) in one of the inputs. I know the chances are a bit low for a duplicate to happen but how can I add a condition that checks if the RandomString matches an existing entry in my database then regenerates it?

You can do a search for the entry as a scheduled back-end workflow and re-generate a new code by scheduling it again if the code exists.

Recursive workflow is your best option.