Unique Id Field for Gravity Forms


This plugin adds a button called 'Unique ID' to your Gravity Form Advanced Fields group. Add it to your form to automatically include a unique id with each successful submission.

Product Description

Generate a unique id in a hidden gravity form Unique Id Field.

Version 1.3
Compatible with GF 1.9.x and 2.x
Works with WordPress 5.x

This plugin adds a button called ‘Unique ID’ to your Gravity Form Advanced Fields group. Add it to your form to automatically include a hidden unique id field with each successful submission.

This plugin is superior to other ways of adding a unique value in two ways:

  1. It populates the unique id on form load. Therefore, it is available in your merge tags and can be included in email notifications.
  2. It checks to make sure it does not appear elsewhere in your Gravity Forms Lead/Entry Detail table Value field (including a unique id generated from another form). Just to make sure it is indeed unique.

The Unique ID Field is prefixed with AZ_ but you can change that by adding this code to your functions file:

add_filter( 'az_gf_uid_filter', 'my_function_to_change_prefix');

function my_function_to_change_prefix ($prefix) {
   return 'XYZ_';

(Change XYZ_ to what you would like for your prefix.)

There is a filter to change the entire unique id if you want :


function change_value_to_timestamp($value){
 return current_time('timestamp'); // change the unique id to the current timestamp using your WordPress timezone setting

Geek alert:

This plugin uses PHP’s uniqid function. Read more here: http://php.net/manual/en/function.uniqid.php

Get the value of the unique id after submission by input id if known : EX: $unique_id = rgar( $entry, '24' )
or using GF API if not known.

$unique_id_fields = GFAPI::get_fields_by_type( $form, ['az_unique_id'] );
$unique_id = rgar( $entry, $unique_id_fields[0]->id );

Content of the plugin ReadMe.txt file located in your plugin:

Please view the readme.txt file in your plugin for documentation.

Available hooks in the plugin:

Change the prefix from ‘AZ_’ before the id is generated:

$prefix = apply_filters( 'az_gf_uid_filter', 'AZ_' );

Filter the generated unique id:

$id = apply_filters( 'az_gf_value_filter', $id);

Related Products