I'm not a programmer.

I need to generate unique voucher codes in Cognito Forms.

They need to include the (integer)Entry.Number + 10,000 as a 5 character string. E.g. if the (unique) serial Entry.Number is "13" I need to create a string "10013".

I'm not sure if Entry.Number is a numeric or string but I have a numeric integer field: EntryNumber=Int32.Parse(Entry.Number)+10000

and text field: VoucherCode=SomeString+EntryNumber

However the VoucherCode is always empty.

I know that that Entry.Number is only generated when the form is submitted but even if I put VoucherCode in the confirmation message, it still comes out empty.

Create incrementing number field in Cognito Form suggests that you CAN use Entry.Number in calculations.

If this isn't at all possible I need another mechanism to generate a unique 5 character string for inclusion into each voucher number.

1 Answer 1


To include a unique ID number on your form confirmation page:

  1. Add a Calculation field to your form labelled Voucher Code (or something similar).

  2. Set the calculation to the following expression:

=(Int32.Parse(Entry.Number) + 10000).ToString("D")

  1. Insert the Voucher Code field into your form confirmation message.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.