Generating unique number for entity number/gift voucher etc

OK, so I have used {RANDOM} tag with its expressions before for generating booking number on one system and voucher number on another however am not convinced on this as a truly legitimate use of this…
In theory yes a 8-10 digit random number is very unlikely to get a duplicate however if it is truly random and it being very unlikely there is nothing from stopping you getting a repeat long before 999999999 uses.

I have tried searching but do we have a way to use the built in number generators?
Ie we setup a new one say voucher number or booking id, member number etc and for each request it increases?
This would then mean we could have a shorter number for these, particularly things like member numbers?
I know we could use a program setting and increase by one each time and have a sequential number but since we have number generator wouldn’t it make seance to use them?

@QMcKay - I cant find it but saw a while back in one of your script you had something like .getUniqueNumber or something like that. was that a custom script?

Number generators are tied to ticket type. Create a new ticket type and you can define new number generators.

But am looking to use them outside of a ticket, or rather for other things… or am i missing a trick?

It is used in the GC Tutorial. It isn’t random; rather it generates a Date/Time …




So the only “unique” thing about it is the last 3 digits since it would be milliseconds.

1 Like

Is that a hardcoded script or your own?

Hard-coded helper that has been available for a long time, even before scripting.