Skip to content
GPLWP Guides

How to generate unique IDs for Gravity Forms submissions

Forms Time About 20 minutes 5 steps Updated 11 Nov 2026

FORMS
The short answer

Gravity Forms automatically assigns each submission a unique entry ID, which you can show in confirmations and notifications with the {entry_id} merge tag. If you need a stored field with a prefix, fixed length, or form-specific sequence, use custom code or the Gravity Perks Unique ID Plugin.

The route
  1. 01Choose the ID you actually need
  2. 02Use the built-in entry ID
  3. 03Add custom code only when needed
  4. 04Install the Unique ID add-on
  5. 05Show and verify the reference

What you need

  • A working Gravity Forms form
  • Gravity Forms administrator access
  • A clear ID format, such as REF-000123
  • A staging site or recent backup if adding custom code

Choose the ID you actually need

Decide whether the built-in entry ID is enough or whether you need a customer-facing reference such as REF-000123. The built-in entry ID is unique across the site’s Gravity Forms entries, but it is not a separate sequence for each form and cannot be given a prefix through the normal form settings.

Use the entry ID for a simple internal reference. Use a custom ID when people must read it, when each form needs its own numbering, or when you need alphanumeric formatting.

Use the built-in entry ID

For the manual route, open the form’s confirmation or notification settings and insert {entry_id} where the reference number should appear. Gravity Forms makes this merge tag available after the entry has been saved, so it works in confirmations and notifications but not as a field’s default value.

Submit the form once and check both the confirmation and the email. Remember that this number is the database entry ID: it is sequential across all forms on the site, so unrelated forms can consume numbers between two submissions of your form.

Add custom code only when needed

If you need the ID stored in a form field, add a hidden field and use the gform_entry_post_save filter to build the value from the saved entry ID. For example, a developer can create a value such as REF- followed by the entry ID, then save it with GFAPI::update_entry_field(). Gravity Forms documents both the post-save filter and the API method for updating an entry field.

Replace the form and field IDs in the code with your own, and test it on staging first. This approach gives you a site-wide unique value derived from the entry ID, but it does not provide an independent per-form counter. Do not calculate the next number by counting existing entries: deleted entries, imports, concurrent submissions, and failed attempts can create gaps or duplicates.

Install the Unique ID add-on

For a configurable ID, install and activate the Gravity Perks Unique ID Plugin, then edit the form and add its Unique ID field. Choose Sequential for a counting reference, Numeric for digits only, or Alphanumeric for a mixed value. Sequential IDs are generated per field and can be configured with a starting number, length, prefix, and suffix.

This is the fast route when you need a form-specific sequence or a format such as CASE-00125. It avoids maintaining custom PHP and provides the generated value as a normal field that can be used with Gravity Forms merge tags.

Show and verify the reference

In the confirmation and notification settings, use the field merge-tag picker to insert the Unique ID field. Field merge tags use the field label and field ID, for example {Reference:5}; using the picker avoids mistakes when the field ID is different on your form.

Submit two test entries and confirm that the values are different, appear in the entry list, and arrive in the expected email or confirmation. Test a failed validation, a resubmission, and any payment or approval workflow separately. The common Friday problem is displaying the ID in an email but forgetting to store or display the same field in the admin entry.

The fast route

Let Gravity Perks Unique ID Plugin do it

Generates customizable sequential or alphanumeric IDs for entries, ideal when each Gravity Forms submission needs a trackable reference number.

Get Gravity Perks Unique ID Plugin

Sources

  1. docs.gravityforms.com /entry_id-merge-tag/?utm_source=openai
  2. docs.gravityforms.com /gform_entry_post_save/?utm_source=openai
  3. gravitywiz.com /documentation/gravity-forms-unique-id/?utm_source=openai
  4. docs.gravityforms.com /merge-tags-reference/?utm_source=openai
  5. community.gravityforms.com /t/rename-entry-id-with-prefix/11278?utm_source=openai

Questions

Does Gravity Forms already generate a unique ID for every submission?
Yes. Gravity Forms assigns every saved entry a unique numeric entry ID, and you can display it after submission with the <code>{entry_id}</code> merge tag. That ID is unique across all Gravity Forms entries on the site, not just entries from one form. It is suitable for internal references, but it does not provide a custom prefix, suffix, fixed format, or separate counter for each form.
Can I use the entry ID in a confirmation message or email?
Yes. Add <code>{entry_id}</code> to a Gravity Forms confirmation or notification, where Gravity Forms replaces it with the saved entry’s number. You cannot use it as a field default because the entry does not have its database ID until after saving. If you need the value inside a field, use a generated Unique ID field or custom post-save code instead.
Can I make the built-in ID start at 1000 or add a prefix?
No, not through the normal Gravity Forms entry-ID settings. The built-in entry ID remains a numeric database identifier. You can show it with a prefix in a message, such as <code>REF-{entry_id}</code>, but that does not change or rename the actual entry ID. For a stored value with a prefix, padding, or custom starting number, create a separate field with custom code or a Unique ID add-on.
Are sequential Unique IDs generated separately for each form?
The Gravity Perks Unique ID field generates sequential values per Unique ID field, so it is suited to form-specific numbering. You can set the starting number, padding length, prefix, and suffix in the field settings. This is different from the built-in entry ID, which is sequential across entries from all forms on the site.
Should I count entries to create the next reference number?
No. Counting existing entries is unsafe because entries may be deleted, imported, marked as spam, or submitted at the same time. It can produce duplicates or unexpected gaps. Use Gravity Forms’ saved entry ID for a simple unique value, or use a dedicated Unique ID field that maintains its own sequence and formatting rules. Test the result with duplicate submissions and any payment or approval steps before using it operationally.