Forum Academy Marketplace Showcase Pricing Features

Creating a Unique random string for Discount Code

I am trying to create random uniques Discount code with user specified Numeric series say (Start Series) 12000 to (End-series) 12500.

  1. I am generating Random number using ToolBox list of numbers within series only when the code :count is <1 - DONE
  2. now to create a loop to check for duplicates and regenerating the code again - NEED HELP
  3. to stop generating code once it reaches (End-series)12500 - NEED HELP

I am sure we need to use Backend Workflow for this, as per nice article by @adamhholmes
Continuing the discussion from Creating a unique random string for a username:

However a bit of explanation would do great help.
Thanks in advance.

Just to understand…

  1. Why you need the “series”? Just to know the amount of codes to generate? Or you use this numbers in your promocodes?

Hi @rpetribu
Different users may use different digits discount series, 2,3,6 or 8 digits, these codes are blocked from master series of existing codes.

the solution Creating random unique IDs that do not duplicate - #2 by daniel10 @daniel10 is great, however creating random numbers between start series (12000) and end series (15000) is coming out to be a problem.
Bubble is heavily dependent on long unique id of a thing which i understand is good, however in not all circumstances.
will update if i find a solution here.

as suggested by @daniel10 , this solution makes sense. Thanks