Cognito Forms logo
Experience the future of Form Building Start Building Now!

Generating Unique IDs for Your Form Entries!

Posted by Nadia A. 12/15/2016 Categories: Tips & Tricks

Whether you use Cognito Forms to collect payment or to process service requests, all Cognito Forms entries generate their own unique ID based on the order that they're submitted in. And, not only can you display this number to your users in the form confirmation message/email confirmations, you can also use the entry number in calculations to create your own custom ID codes.

Displaying the entry number

On your Entries page, you'll notice a number to the very left of each entry:

This unique entry number is generated automatically, starting with 1 and increasing by 1 for each new entry. The entry number is assigned when an entry is first saved or submitted. It never changes, and it will never be reused; even after the entry is deleted. Additionally, form entries with payment will also generate a separate unique transaction number that corresponds with your PayPal or Stripe account. (You’ll need this if you ever make changes to your transactions within PayPal/Stripe instead of Cognito Forms).

You can display the entry number to your users in a couple of different places:

Confirmation message

To add the entry number to your form confirmation message, simply go to Submission Settings in your form builder and select the message area. Then, open the Insert Field dropdown and select Entry.Number:

Email notifications/confirmations

From your Submission Settings, open the email notification/confirmation settings. Then, insert the entry number into the Subject line or the Message of your email:

Creating custom IDs

In some cases, your organization may want to create a more customized ID for each entry. For example, let's say you want to generate a unique voucher code for each submitted form, and each voucher code needs to be at least four characters long (ex: 1001 and 1002 rather than just 1 and 2). 

To do this, start by adding a Calculation field to your form labelled "Voucher Code" (or something similar). Make sure to set the field to Internal view only, as the field will initially be blank before the form is submitted. Next, use the following expression as your calculation:

=Entry.Number + 1000

Save your changes. Now, when an entry is submitted, this calculation will simply add 1000 to the existing entry number:

As I mentioned in the section above, you can share this code with your users by inserting the Voucher Code calculation field into your form's confirmation message or in the confirmation email:

For further customization, you can even add different characters (like letters) to your entry number: 

="C" + (Entry.Number + 100000).ToString("D")

This particular string will generate: "C100001", "C100002", "C100003", etc.

Have any questions about creating unique entry IDs, or Cognito Forms in general? Contact us today!

Gravatar Nadia is the Inbound Marketing Coordinator for Cognito Forms. In her spare time, Nadia enjoys spending far too much time on YouTube, eating Swedish Fish, and cuddling with her two Chihuahuas.
Printable View