Random Reference Number - Check Unique

I can see there’s a computation example to generate a random number. We’re interested in using this to generate a random ID number but obviously this needs to be unique.

How would we go about checking and, if needed, regenerating a number?

Hi Chris,
I am not sure of the exact computation you are referring to. However, assuming it generates a valid Alloy ID, a quick way to check if it does not clash with another one in the system would be to do an AQS query with the generated ID on the items interface. If the count of the returned items is zero, then it is unique.
If the computation is generating another type of ID (not an Alloy ID) which you store as an attribute in some design, the logic would be the same, only this time you do an AQS query for that specific ID value on the ID attribute of your design.
The above can be done via Workflow Computations within Alloy, or using a 3rd party program/script that enforces this rationale using the API.
Perhaps the developers in the team may have additional ideas of how you could accomplish this task, but this is a quick solution that comes to mind.

Kind Regards,