Question
![](https://accounts.pega.com/sites/default/files/pega-user-image/145/REG-145090.png?source=PUMINIT)
Rabobank
NL
Last activity: 18 Apr 2020 18:03 EDT
Generate unique code (for ex. discount voucher code) to provide in an offer - batch campaign
Hi guys,
We have got a requirement to send a unique voucher code inside an email for a specific as part of batch outbound campaign. The voucher code should be a fixed-length code (with alphanumeric and special characters only) and unique per customer and should only be used once, so let's say if a code "xYz12sD" has been generated and sent once, it should never be generated again.
We have 2 proposed mechanism:
1) Codes will be generated by a 3rd party solution and sent to Pega in a file every 'x' day and we have to maintain the logic of using it once etc as well as integration with the source.
2) Generate codes in Pega, this will eliminate dependency/integration with another solution.
The question is if we want to go with option 2, how to generate such code inside Pega? And is it advisable to do it in Pega?
Thanks in advance!
Regards, Gaurav