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 reference the form entry number in calculations using the expression
Entry.Number. If your calculation is inside a section/repeating section/table, make sure to use
You can also insert the entry number into the form confirmation page, as well as email notifications and confirmations:
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:
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")
Here, we’re using
ToString("D") to convert the string to a number. This particular string will generate: “C100001”, “C100002”, “C100003”, etc.
Or, use the
DateSubmitted property to display the date the entry was submitted followed by the entry number:
=Entry.DateSubmitted.ToString("yyMMdd") + (Entry.Number.ToString("D"))
Have any questions about creating unique entry IDs, or Cognito Forms in general? Contact us today!
Nadia is the Marketing Coordinator for Cognito Forms. In her spare time, Nadia enjoys listening to French house, drinking iced coffee, and talking about herself in third person.